Skip to main content

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 LIMIT or LIMIT_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_ORDERS filter, and MAX_NUM_ORDERS filter.

HTTP Request

POST /sapi/v1/margin/order/otoco

Request Weight

6(UID)

Request Parameters

NameTypeMandatoryDescription
symbolSTRINGYES
isIsolatedSTRINGNOfor isolated margin or not, "TRUE", "FALSE",default "FALSE"
sideEffectTypeENUMNONO_SIDE_EFFECT, MARGIN_BUY. More info in FAQ
autoRepayAtCancelBOOLEANNOOnly 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
listClientOrderIdSTRINGNOArbitrary 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.
newOrderRespTypeENUMNOFormat of the JSON response. Supported values: Order Response Type
selfTradePreventionModeENUMNOThe allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
workingTypeENUMYESSupported values: LIMIT, LIMIT_MAKER
workingSideENUMYESBUY, SELL
workingClientOrderIdSTRINGNOArbitrary unique ID among open orders for the working order. Automatically generated if not sent.
workingPriceDECIMALYES
workingQuantityDECIMALYES
workingIcebergQtyDECIMALNOThis can only be used if workingTimeInForce is GTC.
workingTimeInForceENUMNOGTC,IOC,FOK
pendingSideENUMYESBUY, SELL
pendingQuantityDECIMALYES
pendingAboveTypeENUMYESSupported values: LIMIT_MAKER, STOP_LOSS, and STOP_LOSS_LIMIT
pendingAboveClientOrderIdSTRINGNOArbitrary unique ID among open orders for the pending above order. Automatically generated if not sent.
pendingAbovePriceDECIMALNO
pendingAboveStopPriceDECIMALNO
pendingAboveTrailingDeltaDECIMALNO
pendingAboveIcebergQtyDECIMALNOThis can only be used if pendingAboveTimeInForce is GTC.
pendingAboveTimeInForceENUMNO
pendingBelowTypeENUMNOSupported values: LIMIT_MAKER, STOP_LOSS, and STOP_LOSS_LIMIT
pendingBelowClientOrderIdSTRINGNOArbitrary unique ID among open orders for the pending below order. Automatically generated if not sent.
pendingBelowPriceDECIMALNO
pendingBelowStopPriceDECIMALNO
pendingBelowTrailingDeltaDECIMALNO
pendingBelowIcebergQtyDECIMALNOThis can only be used if pendingBelowTimeInForce is GTC.
pendingBelowTimeInForceENUMNO
  • autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution

  • Depending on the pendingAboveType/pendingBelowType or workingType, some optional parameters will become mandatory:

    TypeAdditional mandatory parametersAdditional information
    workingType = LIMITworkingTimeInForce
    pendingAboveType= LIMIT_MAKERpendingAbovePrice
    pendingAboveType= STOP_LOSSpendingAboveStopPrice and/or pendingAboveTrailingDelta
    pendingAboveType=STOP_LOSS_LIMITpendingAbovePrice, pendingAboveStopPrice and/or pendingAboveTrailingDelta, pendingAboveTimeInForce
    pendingBelowType= LIMIT_MAKERpendingBelowPrice
    pendingBelowType= STOP_LOSSpendingBelowStopPrice and/or pendingBelowTrailingDelta
    pendingBelowType=STOP_LOSS_LIMITpendingBelowPrice, pendingBelowStopPrice and/or pendingBelowTrailingDelta, 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"
}
]
}