GTT OCO Order
This API allows you to place a one-cancels-other (OCO) GTT order with two legs, where the first leg to trigger cancels the other.
USE CASE
Set a target and a stop-loss together on a position you hold, so whichever triggers first cancels the other.
Details
- This type allows you to place both a Stop Loss and a Target order simultaneously. If one order is triggered, the other gets automatically canceled.
- To avoid rejections:
- For Leg1: The trigger price must always be greater than the LTP
- For Leg 2: The trigger price must always be less than the LTP
- It uses the same endpoint as a single GTT. Sending both
leg1andleg2makes the order an OCO. - Each leg carries its own
price,triggerPriceandqty. - Product type can be CNC, MARGIN or MTF. The order stays active for up to one year unless a leg triggers or you cancel it.
- Response code
1101means the order was placed. Code201means it is in transit, so confirm it in the GTT Order Book. - In the GTT Order Book an OCO order shows
gtt_oco_indas 2, and the second leg appears inprice2_limit,price2_triggerandqty2. - Rate limits differ between the Standard and Prime plans. See Plans & rate limits.
Request Attributes
| Attribute | Data Type | Description |
|---|---|---|
Side | int | Indicates the side of the order: 1 for buy, -1 for sell. |
symbol* | string | The instrument's unique identifier, e.g., "NSE:CHOLAFIN-EQ" |
productType* | string | The product type for the order. Valid values: "CNC", "MARGIN", "MTF". |
orderInfo* | object | Contains information about the GTT/OCO order legs. |
orderInfo.leg1* | object | Details for GTT order leg. Mandatory for all orders. |
orderInfo.leg1.price* | float | Price at which the order |
orderInfo.leg1.triggerPrice | float |
|
orderInfo.leg1.qty* | int | Quantity for the GTT order leg. |
orderInfo.leg2* | object | Details for OCO order leg. Optional and included only for OCO orders. |
orderInfo.leg2.price* | float | Price at which the second leg of the OCO order should be placed. |
orderInfo.leg2.triggerPrice* | float |
|
orderInfo.leg2.qty* | int | Quantity for the second leg of the OCO order.. |
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
code | int |
|
message* | string | Descriptive message about the request status, e.g., "Successfully placed order". |
s* | string | Request status indicator: "ok" for success, "error" for failure. |
id* | string | Unique identifier for the placed order, returned when the order is successfully processed. |
Last updated on