Skip to main content

Margin Account New OCO(TRADE)

API Description#

Send in a new OCO for a margin account

HTTP Request#

POST /papi/v1/margin/order/oco

Request Weight(Order)#

1

Request Parameters#

NameTypeMandatoryDescription
symbolSTRINGYES
listClientOrderIdSTRINGNOA unique Id for the entire orderList
sideENUMYES
quantityDECIMALYES
limitClientOrderIdSTRINGNOA unique Id for the limit order
priceDECIMALYES
limitIcebergQtyDECIMALNO
stopClientOrderIdSTRINGNOA unique Id for the stop loss/stop loss limit leg
stopPriceDECIMALYES
stopLimitPriceDECIMALNOIf provided, stopLimitTimeInForce is required.
stopIcebergQtyDECIMALNO
stopLimitTimeInForceENUMNOValid values are GTC/FOK/IOC
newOrderRespTypeENUMNOSet the response JSON.
sideEffectTypeENUMNONO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY; default NO_SIDE_EFFECT.
recvWindowLONGNOThe value cannot be greater than 60000
timestampLONGYES

Other Info:

  • 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.

Response Example#

{  "orderListId": 0,  "contingencyType": "OCO",  "listStatusType": "EXEC_STARTED",  "listOrderStatus": "EXECUTING",  "listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",  "transactionTime": 1563417480525,  "symbol": "LTCBTC",  "marginBuyBorrowAmount": "5",       // will not return if no margin trade happens  "marginBuyBorrowAsset": "BTC",    // will not return if no margin trade happens  "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"    }  ]}