OCO Orders
Stop-loss + target bracket pairs, and adjusting a position via the option chain.
Stop-loss + target pairs — SL and TP legs that cancel each other once one fires.
hasOCO
Whether the broker supports OCO (One Cancels Other) orders. false disables target/take-profit
order placement entirely — everything on this page becomes unreachable from the chart's own UI.
bool get hasOCO => true;placeOCOOrder / modifyOCOOrder / cancelOCOOrder
void placeOCOOrder(String params);
void modifyOCOOrder(String params);
void cancelOCOOrder(String groupId);
void groupAdjustOrders(String params);placeOCOOrder/modifyOCOOrder params:
{
"side": "buy", "productType": "normal", "stopPrice": 2350.0, "stopQty": 10,
"symID": "RELIANCE", "targetPrice": 2450.0, "targetQty": 10,
"targetTriggerPrice": 2440.0, "groupId": "OCO001"
}| Field | Type | Accepted values |
|---|---|---|
side | String | required; "buy" / "sell", case-insensitive |
productType | String | required; "normal" or "intraday" — top-level, not nested per leg; both legs of one pair always protect the same position |
stopPrice | double | required; stop-loss leg price |
stopQty | int | required; stop-loss leg quantity |
symID | String | required; the symbol |
targetPrice | double | required; target leg price |
targetQty | int | required; target leg quantity |
targetTriggerPrice | double | required; target leg trigger price |
groupId | String | optional on placeOCOOrder; required on modifyOCOOrder |
cancelOCOOrder's groupId is the plain string, no leg data needed.
groupAdjustOrders params — simultaneously exit held legs and add new ones from the option
chain:
{
"exit": [
{ "action": "Buy", "id": "NIFTY2560023000PE", "ordType": "market", "price": 120.5, "quantity": 50 }
],
"add": [
{ "action": "Sell", "id": "NIFTY2560024000CE", "ordType": "limit", "price": 85.0, "quantity": 50 }
]
}| Field | Type | Accepted values |
|---|---|---|
exit[].action / add[].action | String | required; "Buy" / "Sell" |
exit[].ordType / add[].ordType | String | required; "market" / "limit" — a smaller set than placeOrder's orderType, no stop variants |
id | String | required; the option contract's symbol id |
price | double | required; leg price |
quantity | int | required; leg quantity |
exit — exit legs for currently-held positions (action inverted from the position side,
e.g. a long position exits with "Sell"). add — new entry legs selected from the option
chain.
ocoOrdersStreamer
Pending trigger pairs only — SL+TP legs not yet real orders. Once a leg fires, the broker
reports it on ordersStreamer instead, as a plain
order.
Stream<String> get ocoOrdersStreamer;Must be a broadcast stream.
[
{
"groupId": "OCO001", "symID": "RELIANCE", "name": "Reliance Industries",
"exchange": "NSE", "side": "sell", "productType": "normal",
"stopLoss": { "type": "stoploss", "side": "sell", "triggerPrice": 2350.0, "qty": 10, "price": 2340.0, "fillQty": 0 },
"target": { "type": "limit", "side": "sell", "triggerPrice": 0.0, "qty": 10, "price": 2450.0, "fillQty": 0 }
}
]| Field | Type | Accepted values |
|---|---|---|
groupId | String | required; the pair's own identifier |
symID | String | required; the symbol |
name | String | optional; display name — note the key is name, not displayName; falls back to symID if omitted |
exchange | String | required; exchange identifier |
side | String | required; "buy" / "sell", case-insensitive |
productType | String | required; "normal" or "intraday" — top-level, shared by both legs |
stopLoss / target | object | required; one OCOLeg each (see below) — both always populated; there's no unpaired form |
OCOLeg shape (used for both stopLoss and target):
| Field | Type | Accepted values |
|---|---|---|
type | String | required; "stoploss" or "limit" — lowercase, same values as Orders' type/orderType |
side | String | required; "buy" / "sell" |
triggerPrice | double | required; leg trigger price |
qty | int | required; leg quantity |
price | double | required; leg price |
fillQty | int | required; quantity filled so far, 0 if none |