Modify GTT
PUT /gttoco/modifyGtt
Modifying a GTT (Good Till Triggered) order allows investors to adjust the parameters of their existing GTT orders. This can include changing the trigger price, altering the quantity of the order, productType, limitPrice, marketProtection or modifying the order type.
Steps to modify a GTT (Good Till Trigger) order :
- Retrieve all active GTT orders using the List GTT OCO API. In the 'List GTT OCO ' API response, we will get both active GTT and GTT OCO orders. To identify an GTT order, check if the 'triggers' key in the API response contains 'gtt' key. If it does, then it is an GTT order.
- Note down the GTT summary ID of the order you wish to modify.Then, based on the parameters provided below, you can modify your order.
After the order is modified, a new gttSummaryId is generated. For any further operation, this new gttSummaryId will be valid for this order and the old gttSummaryId becomes invalid.
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
exchange | string | true | The valid exchange will remain the same as it was at the time of creating the GTT. It cannot be modified. |
symbolName | string | true | The symbol name will also remain the same as it was at the time of creating the GTT. It cannot be modified. |
transactionType | string | true | Determines whether the order is a buy or sell transaction. |
quantity | number | true | Defines the number of units or shares of the asset to be bought or sold. |
productType | string | true | Product type of the order. Can be CNC (Cash and Carry) or NRML (Normal). |
orderType | string | true | Type of order placed. Can be MKT (Market Order) or L (Limit Order). |
triggerPrice | number | true | Represents the market-entry price level for the placed order. |
limitPrice | number | true | Price at which the order is executed in the market. |
marketProtection | string | true | Required for market orders. Default is set to 3% to protect the order from potential market losses. |
gttSummaryId | number | true | Enter the gttSummaryId of the GTT order you want to modify. |
Sample Request Body
requestBody={
"symbolName": "WIPRO24JUN585PE",
"exchange": "NFO",
"transactionType": "BUY",
"orderType": "MKT",
"quantity": "500",
"productType": "NRML",
"triggerPrice": "124.7",
"limitPrice": "126.7",
"marketProtection": "12",
"gttSummaryId":"945505"
}Live trading endpoint
This sample sends a real request against your trading account. Replace <SESSION_TOKEN> and review every field before running — Samco does not provide a sandbox, and any successful call affects live positions and balances.
Sample Code
curl -X PUT 'https://tradeapi.samco.in/gttoco/modifyGtt' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>' \
-d '{"symbolName":"WIPRO24JUN585PE","exchange":"NFO","transactionType":"BUY","orderType":"MKT","quantity":"500","productType":"NRML","triggerPrice":"124.7","limitPrice":"126.7","marketProtection":"12","gttSummaryId":"945505"}'import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Sample {
public static void main(String[] args) throws Exception {
String requestBody = """
{
"symbolName": "WIPRO24JUN585PE",
"exchange": "NFO",
"transactionType": "BUY",
"orderType": "MKT",
"quantity": "500",
"productType": "NRML",
"triggerPrice": "124.7",
"limitPrice": "126.7",
"marketProtection": "12",
"gttSummaryId": "945505"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/gttoco/modifyGtt"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.PUT(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}(async () => {
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
};
const requestBody = {
symbolName: "WIPRO24JUN585PE",
exchange: "NFO",
transactionType: "BUY",
orderType: "MKT",
quantity: "500",
productType: "NRML",
triggerPrice: "124.7",
limitPrice: "126.7",
marketProtection: "12",
gttSummaryId: "945505"
};
const response = await fetch('https://tradeapi.samco.in/gttoco/modifyGtt', {
method: 'PUT',
headers,
body: JSON.stringify(requestBody),
});
const data = await response.json();
console.log(data);
})();import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-session-token': '<SESSION_TOKEN>',
}
requestBody = {
"symbolName": "WIPRO24JUN585PE",
"exchange": "NFO",
"transactionType": "BUY",
"orderType": "MKT",
"quantity": "500",
"productType": "NRML",
"triggerPrice": "124.7",
"limitPrice": "126.7",
"marketProtection": "12",
"gttSummaryId": "945505"
}
r = requests.put('https://tradeapi.samco.in/gttoco/modifyGtt',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Responses
{
"serverTime": "02/06/24 12:00:52",
"msgId": "82452735-e3b8-4fc4-8346-0ef314b5a404",
"status": "Success",
"statusMessage": "GTT MODIFIED",
"gttSummaryId": "945510",
"orderDetails": {
"productType": "NRML",
"orderType": "MKT",
"triggerPrice": "124.7",
"marketProtection": "12",
"transactionType": "BUY",
"limitPrice": "",
"symbol": "146465_NFO",
"symbolName": "WIPRO24JUN585PE",
"quantity": "500"
}
}
{
"serverTime": "15/05/24 18:49:18",
"msgId": "e4d832c0-c7ac-405c-bf0a-6eebc9214150",
"status": "Failure",
"statusMessage": "TRIGGER DOES NOT EXIST",
"orderDetails": {
"productType": "NRML",
"orderType": "MKT",
"triggerPrice": "124.7",
"marketProtection": "12",
"transactionType": "SELL",
"limitPrice": "",
"symbol": "532540_BSE",
"symbolName": "TCS",
"quantity": "500"
}
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | The time when the server processed the request. |
msgId | string | A unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request. |
status | string | The status of the API response. Possible values: 'Success', 'Error', or 'Failure'. |
statusMessage | string | A message describing the result of the API call. |
gttSummaryId | string | After the order is modified, a new gttSummaryId is generated. Use this new gttSummaryId for further operations; the old one becomes invalid. |
orderDetails | Object | Details of the modified order. |
productType | string | The product type of the order. |
orderType | string | The type of order. |
triggerPrice | string | The trigger price for the order. |
marketProtection | string | The market protection percentage for the order. |
transactionType | string | The transaction type for the order. |
limitPrice | string | The price at which the order is executed in the market. |
symbol | string | The actual name of the symbol for the scrip. |
symbolName | string | The name of the symbol representing the scrip. |
quantity | string | Defines the number of units or shares of the asset to be bought or sold. |