Margin

Margin Account New OCO (TRADE)

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

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

Changed in 2 of the 26 revisions of this API.240

    • added the new optional query request parameter selfTradePreventionMode

      new-optional-request-parameter

  • a484ce871a72239See the full diff
    • for the query request parameter recvWindow, the type/format was changed from integer/ to integer/int64

      request-parameter-type-changed

    • for the query request parameter timestamp, the type/format was changed from integer/ to integer/int64

      request-parameter-type-changed

    • for the query request parameter limitIcebergQty, the type/format was generalized from number/float to number/double

      request-parameter-type-generalized

    • for the query request parameter price, the type/format was generalized from number/float to number/double

      request-parameter-type-generalized

    • for the query request parameter quantity, the type/format was generalized from number/float to number/double

      request-parameter-type-generalized

    • for the query request parameter stopIcebergQty, the type/format was generalized from number/float to number/double

      request-parameter-type-generalized

    • for the query request parameter stopLimitPrice, the type/format was generalized from number/float to number/double

      request-parameter-type-generalized

    • for the query request parameter stopPrice, the type/format was generalized from number/float to number/double

      request-parameter-type-generalized

    • the response property code became required for the status 400

      response-property-became-required

    • the response property code became required for the status 401

      response-property-became-required

    • the response property contingencyType became required for the status 200

      response-property-became-required

    • the response property isIsolated became required for the status 200

      response-property-became-required

    • the response property listClientOrderId became required for the status 200

      response-property-became-required

    • the response property listOrderStatus became required for the status 200

      response-property-became-required

    • the response property listStatusType became required for the status 200

      response-property-became-required

    • the response property marginBuyBorrowAmount became required for the status 200

      response-property-became-required

    • the response property marginBuyBorrowAsset became required for the status 200

      response-property-became-required

    • the response property msg became required for the status 400

      response-property-became-required

    • the response property msg became required for the status 401

      response-property-became-required

    • the response property orderListId became required for the status 200

      response-property-became-required

    • the response property orderReports became required for the status 200

      response-property-became-required

    • the response property orderReports/items/clientOrderId became required for the status 200

      response-property-became-required

    • the response property orderReports/items/cummulativeQuoteQty became required for the status 200

      response-property-became-required

    • the response property orderReports/items/executedQty became required for the status 200

      response-property-became-required

    • the response property orderReports/items/orderId became required for the status 200

      response-property-became-required

    • the response property orderReports/items/orderListId became required for the status 200

      response-property-became-required

    • the response property orderReports/items/origQty became required for the status 200

      response-property-became-required

    • the response property orderReports/items/price became required for the status 200

      response-property-became-required

    • the response property orderReports/items/side became required for the status 200

      response-property-became-required

    • the response property orderReports/items/status became required for the status 200

      response-property-became-required

    • the response property orderReports/items/stopPrice became required for the status 200

      response-property-became-required

    • the response property orderReports/items/symbol became required for the status 200

      response-property-became-required

    • the response property orderReports/items/timeInForce became required for the status 200

      response-property-became-required

    • the response property orderReports/items/transactTime became required for the status 200

      response-property-became-required

    • the response property orderReports/items/type became required for the status 200

      response-property-became-required

    • the response property orders became required for the status 200

      response-property-became-required

    • the response property orders/items/clientOrderId became required for the status 200

      response-property-became-required

    • the response property orders/items/orderId became required for the status 200

      response-property-became-required

    • the response property orders/items/symbol became required for the status 200

      response-property-became-required

    • the response property symbol became required for the status 200

      response-property-became-required

    • the response property transactionTime became required for the status 200

      response-property-became-required