v26

latestOpenAPI 3.0.2raw.githubusercontent.com2024-10-0834042975.6 KB
Margin

Margin Account New OTO (TRADE)

Post a new OTO order for margin account:

  • An OTO (One-Triggers-the-Other) is an order list comprised of 2 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 second order is called the pending order. It can be any order type except for MARKET orders using parameter quoteOrderQty. The pending order is only placed on the order book when the working order gets fully filled.
  • If either the working order or the pending order is cancelled individually, the other order in the order list will also be canceled or expired.
  • When the order list is placed, if the working order gets immediately fully filled, the placement response will show the working order as FILLED but the pending order will still appear as PENDING_NEW. You need to query the status of the pending order again to see its updated status.
  • OTOs add 2 orders to the unfilled order count, EXCHANGE_MAX_NUM_ORDERS filter and MAX_NUM_ORDERS filter.

Weight(UID): 6

post/sapi/v1/margin/order/oto

Query parameters

symbolstring required
Example:BNBUSDT

Trading symbol, e.g. BNBUSDT

isIsolated'TRUE' | 'FALSE'
  • TRUE - For isolated margin
  • FALSE - Default, not for isolated margin
listClientOrderIdstring

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 and the pendingClientOrderId.

newOrderRespType'ACK' | 'RESULT' | 'FULL'

Set the response JSON.

sideEffectType'NO_SIDE_EFFECT' | 'MARGIN_BUY'

Default NO_SIDE_EFFECT

selfTradePreventionMode'EXPIRE_TAKER' | 'EXPIRE_MAKER' | 'EXPIRE_BOTH' | 'NONE'
Example:EXPIRE_TAKER

The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE.

autoRepayAtCancelboolean
Example:true

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

workingType'LIMIT' | 'LIMIT_MAKER' required

Supported values: LIMIT,LIMIT_MAKER

workingSide'BUY' | 'SELL' required

BUY,SELL

workingClientOrderIdstring

Arbitrary unique ID among open orders for the working order. Automatically generated if not sent.

workingPricenumber double required
workingQuantitynumber double required

Sets the quantity for the working order.

workingIcebergQtynumber double required

This can only be used if workingTimeInForce is GTC.

workingTimeInForce'GTC' | 'IOC' | 'FOK'

GTC, IOC, FOK

pendingType'LIMIT' | 'MARKET' | 'STOP_LOSS' | 'STOP_LOSS_LIMIT' | 'TAKE_PROFIT' | 'TAKE_PROFIT_LIMIT' | 'LIMIT_MAKER' required

Supported values: Order Types Note that MARKET orders using quoteOrderQty are not supported.

pendingSide'BUY' | 'SELL' required

BUY,SELL

pendingClientOrderIdstring

Arbitrary unique ID among open orders for the pending order. Automatically generated if not sent.

pendingPricenumber double
pendingStopPricenumber double
pendingTrailingDeltanumber double
pendingQuantitynumber double required

Sets the quantity for the pending order.

pendingIcebergQtynumber double

This can only be used if pendingTimeInForce is GTC.

pendingTimeInForce'GTC' | 'IOC' | 'FOK'

GTC, IOC, FOK

timestampinteger required

UTC timestamp in ms

signaturestring required

Signature

Response

OTO order

orderListIdinteger required
contingencyTypestring required
listStatusTypestring required
listOrderStatusstring required
listClientOrderIdstring required
transactionTimeinteger required
symbolstring required
isIsolatedboolean required

Example response

{
  "orderListId": 13551,
  "contingencyType": "OTO",
  "listStatusType": "EXEC_STARTED",
  "listOrderStatus": "EXECUTING",
  "listClientOrderId": "JDuOrsu0Ge8GTyvx8J7VTD",
  "transactionTime": 1725521998054,
  "symbol": "BTCUSDT"
}