Skip to main content
PUT 

/order/gtt/modify

Modify GTT Order

This API allows to modify an existing Good Till Trigger (GTT) order by modifying its parameters, such as quantity, trigger price, or strategy rules. This ensures flexibility in adjusting trade conditions without canceling and re-creating the order.

Request

curl --location --request PUT 'https://api.upstox.com/v3/order/gtt/modify' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--header 'Content-Type: application/json' \
--data '{
"type": "SINGLE",
"quantity": 1,
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 7.3
}
],
"gtt_order_id": "GTT-C25270200137952"
}'

For additional samples in various languages, please refer to the Sample code section on this page.

Request Body

{
"type": "SINGLE",
"quantity": 1,
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "BELOW",
"trigger_price": 30
}
],
"gtt_order_id": "GTT-CU25090600027002",
}
NameRequiredTypeDescription
typeRequiredstringSpecifies the GTT order type. Indicates if it's a single or multi-leg order.
Possible values: SINGLE, MULTIPLE.
quantityRequiredintegerThe quantity for which the order is to be placed. Note that once an order has reached OPEN status, its quantity cannot be modified.
gtt_order_idRequiredstringThe order ID for which the order must be modified.
rulesRequiredarrayContains the conditions under which the order should be triggered.
rules[].strategyRequiredstringDefines the role of the rule.
Possible values: ENTRY, TARGET, STOPLOSS

ENTRY - The initial condition to place a BUY or SELL order when the trigger price is met. Having an ENTRY rule is mandatory.
TARGET - A condition to exit the position once the desired price level is reached after the ENTRY order is executed.
STOPLOSS - A condition to exit the position when the price moves unfavorably beyond a set threshold.
rules[].trigger_typeRequiredstringSpecifies the condition for triggering the order. The ENTRY strategy can have ABOVE, BELOW, or IMMEDIATE, whereas TARGET and STOPLOSS strategies can only have IMMEDIATE.

Note: In case of ENTRY strategy and order status as OPEN only IMMEDIATE trigger_type is allowed.

Possible values:
BELOW - The order is triggered when the market price drops below the defined trigger price.
ABOVE - The order is triggered when the market price rises above the defined trigger price.
IMMEDIATE - Limit order at user-specified price is sent immediately to the exchange irrespective of the LTP. This order is valid for a day. If the primary leg gets completed then SL and Target legs are valid for 365 days.
rules[].trigger_priceRequiredfloatThe price at which the order should be triggered based on the defined condition.
rules[].trailing_gapOptionalfloatOnly applicable for STOPLOSS strategy for TSL orders. This defines the consistent gap between your stop-loss and the market price, letting your stop-loss trail automatically.

Responses

Response Body

{
"status": "success",
"data": {
"gtt_order_ids": ["GTT-CU25280200021013"]
},
"metadata": {
"latency": 74
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request.
Possible values: success, error
dataobjectResponse data for modify order request.
data.gtt_order_ids[]stringAn array holding the GTT Order ID for the request placed
metadataobjectMetadata information.
metadata.latencyintegerThe overall time taken by API platform to process the request, measured in milliseconds.

Sample Code

Modify Single Leg GTT Order

curl --location --request PUT 'https://api.upstox.com/v3/order/gtt/modify' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--header 'Content-Type: application/json' \
--data '{
"type": "SINGLE",
"quantity": 1,
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 7.3
}
],
"gtt_order_id": "GTT-C25270200137952"
}'

Modify Multiple Leg GTT Order

curl --location --request PUT 'https://api.upstox.com/v3/order/gtt/modify' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--header 'Content-Type: application/json' \
--data '{
"type": "MULTIPLE",
"quantity": 1,
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 7.3
},
{
"strategy": "TARGET",
"trigger_type": "IMMEDIATE",
"trigger_price": 7.64
},
{
"strategy": "STOPLOSS",
"trigger_type": "IMMEDIATE",
"trigger_price": 7.1
}
],
"gtt_order_id": "GTT-C25280200137522"
}'

Modify Trailing Stop Loss GTT Order

curl --location --request PUT 'https://api.upstox.com/v3/order/gtt/modify' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {your_access_token}' \
--header 'Content-Type: application/json' \
--data '{
"type": "MULTIPLE",
"quantity": 1,
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "ABOVE",
"trigger_price": 7.3
},
{
"strategy": "TARGET",
"trigger_type": "IMMEDIATE",
"trigger_price": 7.64
},
{
"strategy": "STOPLOSS",
"trigger_type": "IMMEDIATE",
"trigger_price": 7.1,
"trailing_gap": 0.1
}
],
"gtt_order_id": "GTT-C25280200137522"
}'
  • To place GTT orders with a SELL leg, EDIS authorization is required. You can authorize EDIS from any of our platforms—Web, iOS, or Android by placing a GTT order. Once authorized on any one platform, it will also be valid for API-based orders. You don't need to complete the order; simply going through the authorization flow is sufficient.
  • We currently support a maximum of three rules with no duplicate strategies.
  • Receiving GTT order updates via Webhook requires additional setup, detailed here.
  • Receiving GTT order updates via WebSocket requires additional setup, detailed here.