Margin Account New OTOCO (TRADE)
API Description
Post a new OTOCO order for margin account:
- An OTOCO (One-Triggers-One-Cancels-the-Other) is an order list comprised of 3 orders.
- The first order is called the working order and must be
LIMITorLIMIT_MAKER. Initially, only the working order goes on the order book.- The behavior of the working order is the same as the OTO.
- OTOCO has 2 pending orders (pending above and pending below), forming an OCO pair. The pending orders are only placed on the order book when the working order gets fully filled.
- The rules of the pending above and pending below follow the same rules as the Order List OCO.
- OTOCOs add 3 orders against the unfilled order count,
EXCHANGE_MAX_NUM_ORDERSfilter, andMAX_NUM_ORDERSfilter.
HTTP Request
POST /sapi/v1/margin/order/otoco
Request Weight
6(UID)
Request Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| isIsolated | STRING | NO | for isolated margin or not, "TRUE", "FALSE",default "FALSE" |
| sideEffectType | ENUM | NO | NO_SIDE_EFFECT, MARGIN_BUY. More info in FAQ |
| autoRepayAtCancel | BOOLEAN | NO | Only when MARGIN_BUY order takes effect, true means that the debt generated by the order needs to be repay after the order is cancelled. The default is true |
| listClientOrderId | STRING | NO | Arbitrary unique ID among open order lists. Automatically generated if not sent. A new order list with the same listClientOrderId is accepted only when the previous one is filled or completely expired. listClientOrderId is distinct from the workingClientOrderId, pendingAboveClientOrderId, and the pendingBelowClientOrderId. |
| newOrderRespType | ENUM | NO | Format of the JSON response. Supported values: Order Response Type |
| selfTradePreventionMode | ENUM | NO | The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE |
| workingType | ENUM | YES | Supported values: LIMIT, LIMIT_MAKER |
| workingSide | ENUM | YES | BUY, SELL |
| workingClientOrderId | STRING | NO | Arbitrary unique ID among open orders for the working order. Automatically generated if not sent. |
| workingPrice | DECIMAL | YES | |
| workingQuantity | DECIMAL | YES | |
| workingIcebergQty | DECIMAL | NO | This can only be used if workingTimeInForce is GTC. |
| workingTimeInForce | ENUM | NO | GTC,IOC,FOK |
| pendingSide | ENUM | YES | BUY, SELL |
| pendingQuantity | DECIMAL | YES | |
| pendingAboveType | ENUM | YES | Supported values: LIMIT_MAKER, STOP_LOSS, and STOP_LOSS_LIMIT |
| pendingAboveClientOrderId | STRING | NO | Arbitrary unique ID among open orders for the pending above order. Automatically generated if not sent. |
| pendingAbovePrice | DECIMAL | NO | |
| pendingAboveStopPrice | DECIMAL | NO | |
| pendingAboveTrailingDelta | DECIMAL | NO | |
| pendingAboveIcebergQty | DECIMAL | NO | This can only be used if pendingAboveTimeInForce is GTC. |
| pendingAboveTimeInForce | ENUM | NO | |
| pendingBelowType | ENUM | NO | Supported values: LIMIT_MAKER, STOP_LOSS, and STOP_LOSS_LIMIT |
| pendingBelowClientOrderId | STRING | NO | Arbitrary unique ID among open orders for the pending below order. Automatically generated if not sent. |
| pendingBelowPrice | DECIMAL | NO | |
| pendingBelowStopPrice | DECIMAL | NO | |
| pendingBelowTrailingDelta | DECIMAL | NO | |
| pendingBelowIcebergQty | DECIMAL | NO | This can only be used if pendingBelowTimeInForce is GTC. |
| pendingBelowTimeInForce | ENUM | NO |
-
autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
-
Depending on the
pendingAboveType/pendingBelowTypeorworkingType, some optional parameters will become mandatory:Type Additional mandatory parameters Additional information workingType=LIMITworkingTimeInForcependingAboveType=LIMIT_MAKERpendingAbovePricependingAboveType=STOP_LOSSpendingAboveStopPriceand/orpendingAboveTrailingDeltapendingAboveType=STOP_LOSS_LIMITpendingAbovePrice,pendingAboveStopPriceand/orpendingAboveTrailingDelta,pendingAboveTimeInForcependingBelowType=LIMIT_MAKERpendingBelowPricependingBelowType=STOP_LOSSpendingBelowStopPriceand/orpendingBelowTrailingDeltapendingBelowType=STOP_LOSS_LIMITpendingBelowPrice,pendingBelowStopPriceand/orpendingBelowTrailingDelta,pendingBelowTimeInForce
Response Example
{
"orderListId": 13509,
"contingencyType": "OTO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "u2AUo48LLef5qVenRtwJZy",
"transactionTime": 1725521881300,
"symbol": "BNBUSDT",
"isIsolated": false,
"orders": [
{
"symbol": "BNBUSDT",
"orderId": 28282534,
"clientOrderId": "IfYDxvrZI4kiyqYpRH13iI"
},
{
"symbol": "BNBUSDT",
"orderId": 28282535,
"clientOrderId": "0HCSsPRxVfW8BkTUy9z4np"
},
{
"symbol": "BNBUSDT",
"orderId": 28282536,
"clientOrderId": "dypsgdxWnLY75kwT930cbD"
}
],
"orderReports": [
{
"symbol": "BNBUSDT",
"orderId": 28282534,
"orderListId": 13509,
"clientOrderId": "IfYDxvrZI4kiyqYpRH13iI",
"transactTime": 1725521881300,
"price": "300.00000000",
"origQty": "1.00000000",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BNBUSDT",
"orderId": 28282535,
"orderListId": 13509,
"clientOrderId": "0HCSsPRxVfW8BkTUy9z4np",
"transactTime": 1725521881300,
"price": "0E-8",
"origQty": "1.00000000",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "PENDING_NEW",
"timeInForce": "GTC",
"type": "STOP_LOSS",
"side": "SELL",
"stopPrice": "299.00000000",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BNBUSDT",
"orderId": 28282536,
"orderListId": 13509,
"clientOrderId": "dypsgdxWnLY75kwT930cbD",
"transactTime": 1725521881300,
"price": "301.00000000",
"origQty": "1.00000000",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "PENDING_NEW",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "SELL",
"selfTradePreventionMode": "NONE"
}
]
}