Place GTT Order Betaโ
Good Till Triggered (GTT) order is a condition-based order that remains active until the defined condition (rule) is met. A rule is a precise condition that determines when the system should execute an order. This order can be executed as a single-leg or multi-leg operation, with each leg scheduled to place an order based on a specific rule. Once the condition is met, the order is placed automatically.
Single-Leg Triggerโ
This order uses one rule to place an order when the condition is satisfied. The opening strategy is called ENTRY, where you define a condition to BUY or SELL a stock when the price is above, below, or equal to the trigger price. Once the order is placed, the GTT is complete.
Multi-Leg Triggerโ
This order involves more than one rule and includes follow-up actions. The ENTRY strategy remains the same as in the Single-Leg Trigger, but additional actions can be set.
You can follow the ENTRY strategy with:
- TARGET: A condition to exit the position once the desired price level is reached.
- STOPLOSS: A condition to exit the position when the price moves unfavorably beyond a set threshold.
For example, if your ENTRY is a BUY, the TARGET and STOPLOSS will be SELL orders, and vice versa.
- A GTT order is always placed as a LIMIT order upon execution.
- EDIS validation for Equity GTT orders must be performed on Upstox Pro by placing a GTT order and authorizing EDIS. Validating EDIS for any scrip applies to all scrips. You may choose not to place the order on Upstox Pro after validation, as it is a separate step. Once validated, the API can place GTT equity SELL orders without issues.
- We currently support a maximum of three rules with no duplicate strategies.
- A GTT order remains valid for up to one year from the date of creation if the defined condition is not met.
Header Parametersโ
Name | Required | Type | Description |
---|---|---|---|
Authorization | true | string | Requires the format Bearer access_token where access_token is obtained from the Token API. |
Content-Type | true | string | Indicates the media type of the resource, set as application/json . |
Accept | true | string | Defines the content format the client expects, which should be set to application/json . |
Request Bodyโ
{
"type": "MULTIPLE",
"quantity": 1,
"product": "D",
"instrument_token": "NSE_EQ|INE806A01020",
"transaction_type": "BUY",
"rules": [
{
"strategy": "ENTRY",
"trigger_type": "BELOW",
"trigger_price": 2.57
},
{
"strategy": "TARGET",
"trigger_type": "IMMEDIATE",
"trigger_price": 2.6
},
{
"strategy": "STOPLOSS",
"trigger_type": "IMMEDIATE",
"trigger_price": 2.55
}
]
}
Name | Required | Type | Description |
---|---|---|---|
type | true | string | Specifies the GTT order type. Indicates if it's a single or multi-leg order. Possible values: SINGLE , MULTIPLE . |
quantity | true | integer | Quantity with which the order is to be placed. |
product | true | string | Signifies if the order was either Intraday or Delivery. Possible values: I , D . |
instrument_token | true | string | Key of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix. |
transaction_type | true | string | Indicates whether its a buy or sell order. Possible values: BUY , SELL . |
rules | true | array | Contains the conditions under which the order should be triggered. |
rules[].strategy | true | string | Defines 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. 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_type | true | string | Specifies the condition for triggering the order. The ENTRY strategy can have ABOVE , BELOW , or IMMEDIATE , whereas TARGET and STOPLOSS strategies can only have IMMEDIATE . Possible values: BELOW , ABOVE , IMMEDIATE 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 - The order is triggered when the market price matches the defined trigger price. |
rules[].trigger_price | true | float | The price at which the order should be triggered based on the defined condition. |
- 2XX
- 4XX
Response Bodyโ
{
"status": "success",
"data": {
"gtt_order_ids": ["GTT-CU25280200021013"]
},
"metadata": {
"latency": 88
}
}
Name | Type | Description |
---|---|---|
status | string | A string indicating the outcome of the request. Possible values: success , error |
data | object | Response data for place order request |
data.gtt_order_ids[] | string | An array holding the GTT Order ID for the request placed |
metadata | object | Metadata information. |
metadata.latency | integer | The overall time taken by API platform to process the request, measured in milliseconds. |
Error Codesโ
Error Code | Description |
---|---|
UDAPI1126 | Valid GTT type is required - The request must specify a valid GTT type. |
UDAPI1127 | The 'type' is invalid - The provided GTT type is not recognized. |
UDAPI1128 | GTT rules are required - At least one valid rule must be specified. |
UDAPI1129 | GTT strategy is required - A strategy must be defined for the GTT order. |
UDAPI1130 | Invalid GTT strategy specified - The provided strategy is not supported. |
UDAPI1131 | GTT trigger_type is required - A trigger type must be specified. |
UDAPI1132 | Invalid GTT trigger_type specified - The provided trigger type is not recognized. |
UDAPI1133 | GTT trigger_price is required - A trigger price must be provided. |
UDAPI1136 | For SINGLE type, rules list must contain exactly one rule - A SINGLE type GTT can have only one rule. |
UDAPI1137 | For MULTIPLE type, the rules list must have at least 2 rules but no more than 3 - MULTIPLE type GTT orders must adhere to this rule limit. |
UDAPI1138 | Rules contain an invalid strategy - One or more rules have an unsupported strategy. |
UDAPI1139 | A strategy can only be used once in the rules - Duplicate strategies are not allowed in the rules list. |
UDAPI1140 | Trigger price must be a positive value - Negative or zero trigger prices are not valid. |
UDAPI1141 | One ENTRY strategy is required - At least one ENTRY strategy must be included in the rules. |
UDAPI1142 | Rules contain an invalid trigger_type - One or more rules have an unsupported trigger type. |
UDAPI1143 | Non-ENTRY strategies must have only IMMEDIATE trigger type - Only the IMMEDIATE trigger type is allowed for non-ENTRY strategies. |
Examplesโ
A comprehensive set of examples is provided to illustrate various use cases and implementation scenarios for this API. To view detailed examples and access sample code, please refer to: API Examples.