Margin

Margin Account New OCO (TRADE)

Changed on

Send in a new OCO for a margin account

  • Price Restrictions:
    • SELL: Limit Price > Last Price > Stop Price
    • BUY: Limit Price < Last Price < Stop Price
  • Quantity Restrictions:
    • Both legs must have the same quantity
    • ICEBERG quantities however do not have to be the same.
  • Order Rate Limit
    • OCO counts as 2 orders against the order rate limit.

Weight(UID): 6

post/sapi/v1/margin/order/oco

Request

  • Base URL
    https://api.binance.com
  • URL
    https://api.binance.com/sapi/v1/margin/order/oco
  • Auth
    API key in header X-MBX-APIKEY

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

A unique Id for the entire orderList

side'SELL' | 'BUY' required
Example:SELL
quantitynumber double required
Example:1
limitClientOrderIdstring

A unique Id for the limit order

pricenumber double required
Example:218

Order price

limitIcebergQtynumber double
stopClientOrderIdstring

A unique Id for the stop loss/stop loss limit leg

stopPricenumber double required
Example:220
stopLimitPricenumber double

If provided, stopLimitTimeInForce is required.

stopIcebergQtynumber double
stopLimitTimeInForce'GTC' | 'FOK' | 'IOC'
newOrderRespType'ACK' | 'RESULT' | 'FULL'

Set the response JSON.

sideEffectType'NO_SIDE_EFFECT' | 'MARGIN_BUY' | 'AUTO_REPAY'

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.

recvWindowinteger
Example:5000

The value cannot be greater than 60000

timestampinteger required

UTC timestamp in ms

signaturestring required

Signature

Response

New Margin OCO details

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

will not return if no margin trade happens

marginBuyBorrowAssetstring required

will not return if no margin trade happens

isIsolatedboolean required

Example response

{
  "contingencyType": "OCO",
  "listStatusType": "EXEC_STARTED",
  "listOrderStatus": "EXECUTING",
  "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
  "transactionTime": 1563417480525,
  "symbol": "LTCBTC",
  "marginBuyBorrowAmount": "5",
  "marginBuyBorrowAsset": "BTC",
  "orders": [
    {
      "symbol": "LTCBTC",
      "orderId": 2,
      "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 3,
      "clientOrderId": "xTXKaGYd4bluPVp78IVRvl"
    }
  ],
  "orderReports": [
    {
      "symbol": "LTCBTC",
      "orderId": 2,
      "orderListId": 0,
      "clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos",
      "transactTime": 1563417480525,
      "price": "0.000000",
      "origQty": "0.624363",
      "executedQty": "0.000000",
      "cummulativeQuoteQty": "0.000000",
      "status": "NEW",
      "timeInForce": "GTC",
      "type": "STOP_LOSS",
      "side": "BUY",
      "stopPrice": "0.960664"
    },
    {
      "symbol": "LTCBTC",
      "orderId": 3,
      "orderListId": 0,
      "clientOrderId": "xTXKaGYd4bluPVp78IVRvl",
      "transactTime": 1563417480525,
      "price": "0.036435",
      "origQty": "0.624363",
      "executedQty": "0.000000",
      "cummulativeQuoteQty": "0.000000",
      "status": "NEW",
      "timeInForce": "GTC",
      "type": "LIMIT_MAKER",
      "side": "BUY"
    }
  ]
}

Changes

    • info

      added the new optional query request parameter selfTradePreventionMode

    • breaking

      for the query request parameter recvWindow, the format changed from no format to int64

    • breaking

      for the query request parameter timestamp, the format changed from no format to int64

    • info

      for the query request parameter limitIcebergQty, the format was generalized from float to double

    • info

      for the query request parameter price, the format was generalized from float to double

    • info

      for the query request parameter quantity, the format was generalized from float to double

    • info

      for the query request parameter stopIcebergQty, the format was generalized from float to double

    • info

      for the query request parameter stopLimitPrice, the format was generalized from float to double

    • info

      for the query request parameter stopPrice, the format was generalized from float to double

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property // became required for the status

    • info

      the response property became required for the status

    • info

      the response property became required for the status