Smart Order APIs (GTT)¶
This section outlines the APIs for placing, modifying, and canceling multi-leg "Good Till Triggered" (GTT) orders, which include simultaneous stop-loss and target legs.
Derivative Orders Only
Smart Orders (GTT) are currently supported only for derivative instruments. Equity smart orders are not supported.
| Request Type | Path | Description |
|---|---|---|
| POST | /smart/order | Place a new multi-leg smart order |
| POST | /smart/order/modify | Modify a pending smart order |
| POST | /smart/order/cancel | Cancel a pending smart order |
Place Smart Order¶
This API allows you to place a new multi-leg smart order (GTT).
Endpoint
Request Body
| Parameter | Type | Description |
|---|---|---|
txn_type | string | The transaction type. Enum: "BUY", "SELL" |
exchange | string | The exchange to place the order on. Enum: "NSE" |
segment | string | The market segment. Enum: "DERIVATIVE" |
product | string | The product type. Enum: "MARGIN" |
order_type | string | The type of order. Enum: "LIMIT", "MARKET" |
validity | string | The order validity. Enum: "DAY" |
security_id | string | The unique identifier for the instrument. |
qty | integer | The quantity of the instrument to trade. |
limit_price | number | The price for the main LIMIT order. |
sl_trigger_price | number | The trigger price for the stop-loss leg. |
tgt_trigger_price | number | The trigger price for the target (profit) leg. |
sl_limit_price | number | The limit price for the stop-loss order once triggered. |
tgt_limit_price | number | The limit price for the target order once triggered. |
algo_id | string | Required. Algo identifier for the smart order. Use "99999" for regular smart orders. |
Example Request
Bash
curl --location 'https://api.indstocks.com/smart/order' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"txn_type": "BUY",
"exchange": "NSE",
"segment": "DERIVATIVE",
"product": "MARGIN",
"order_type": "LIMIT",
"validity": "DAY",
"security_id": "51011",
"qty": 75,
"limit_price": 37,
"sl_trigger_price": 34,
"tgt_trigger_price": 41,
"sl_limit_price": 33,
"tgt_limit_price": 38,
"algo_id": "99999"
}'
Validations
- QtyMustBeAboveZero: Qty must be specified and greater than zero
- LimitPriceMustBeAboveZero: Limit price must be specified and greater than zero
- QtyWithinFreezeQty: Qty should be less than freeze qty
- MaxValueOfOption: Max Value of option allowed is enforced
- QtyMultipleOfLotSize: Qty should be multiple of lot size
- MaxSlTriggerPrice: SL Trigger Price should be less than the limit price
- MaxSlLimitPrice: SL Limit Price should be less than the SL trigger price
- MinTgtTriggerPrice: Target Trigger Price should be greater than the limit price
- MinTgtLimitPrice: Target Limit Price should be greater than the target trigger price
Modify Smart Order¶
This API allows you to modify a pending smart order.
Endpoint
Request Body
| Parameter | Type | Description |
|---|---|---|
order_id | string | The unique ID of the order to be modified |
segment | string | The market segment. Enum: "DERIVATIVE" |
qty | integer | The quantity of the instrument to trade |
limit_price | number | The price for the main LIMIT order |
sl_trigger_price | number | The trigger price for the stop-loss leg |
tgt_trigger_price | number | The trigger price for the target (profit) leg |
sl_limit_price | number | The limit price for the stop-loss order |
tgt_limit_price | number | The limit price for the target order |
Example Request
Bash
curl --location 'https://api.indstocks.com/smart/order/modify' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
"order_id": "DRV-123",
"segment": "DERIVATIVE",
"qty": 20,
"limit_price": 0.35,
"sl_trigger_price": 0.15,
"tgt_trigger_price": 41,
"sl_limit_price": 0.1,
"tgt_limit_price": 42
}'
Cancel Smart Order¶
This API allows you to cancel a pending smart order.
Endpoint
Request Body
| Parameter | Type | Description |
|---|---|---|
segment | string | The market segment. Enum: "DERIVATIVE" |
order_id | string | The unique ID of the order to be cancelled. |
Example Request
Bash
curl --location 'https://api.indstocks.com/smart/order/cancel' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
"segment": "DERIVATIVE",
"order_id": "123456789"
}'
Validations
- OrderIdMissing: Order ID is missing or invalid
- OrderCannotBeCancelled: Order is not eligible for cancellation