Skip to main content

Margin Account New Order (TRADE)

API Description#

Post a new order for margin account.

HTTP Request#

POST /sapi/v1/margin/order

Request Weight#

6(UID)

Request Parameters#

NameTypeMandatoryDescription
symbolSTRINGYES
isIsolatedSTRINGNOfor isolated margin or not, "TRUE", "FALSE",default "FALSE"
sideENUMYESBUY
SELL
typeENUMYES
quantityDECIMALNO
quoteOrderQtyDECIMALNO
priceDECIMALNO
stopPriceDECIMALNOUsed with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
newClientOrderIdSTRINGNOA unique id among open orders. Automatically generated if not sent.
icebergQtyDECIMALNOUsed with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
newOrderRespTypeENUMNOSet the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK.
sideEffectTypeENUMNONO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY,AUTO_BORROW_REPAY; default NO_SIDE_EFFECT.
timeInForceENUMNOGTC,IOC,FOK
selfTradePreventionModeENUMNOThe allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
autoRepayAtCancelBOOLEANNOOnly when MARGIN_BUY or AUTO_BORROW_REPAY 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
recvWindowLONGNOThe value cannot be greater than 60000
timestampLONGYES
  • autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution

Response Example#

Response ACK:

{  "symbol": "BTCUSDT",  "orderId": 28,  "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",  "isIsolated": true,       // if isolated margin  "transactTime": 1507725176595
}

Response RESULT:

{    "symbol": "BTCUSDT",    "orderId": 26769564559,    "clientOrderId": "E156O3KP4gOif65bjuUK5V",    "transactTime": 1713873075893,    "price": "0",    "origQty": "0.001",    "executedQty": "0.001",    "cummulativeQuoteQty": "65982.53",    "status": "FILLED",    "timeInForce": "GTC",    "type": "MARKET",    "side": "SELL",    "isIsolated": false,   // if isolated margin    "selfTradePreventionMode": "EXPIRE_MAKER"}

Response FULL:

{  "symbol": "BTCUSDT",  "orderId": 26769564559,  "clientOrderId": "E156O3KP4gOif65bjuUK5V",  "transactTime": 1713873075893,  "price": "0",  "origQty": "0.001",  "executedQty": "0.001",  "cummulativeQuoteQty": "65.98253",  "status": "FILLED",  "timeInForce": "GTC",  "type": "MARKET",  "side": "SELL",  "marginBuyBorrowAmount": 5,       // will not return if no margin trade happens  "marginBuyBorrowAsset": "BTC",    // will not return if no margin trade happens  "isIsolated": true,       // if isolated margin  "selfTradePreventionMode": "NONE",  "fills": [        {            "price": "65982.53",            "qty": "0.001",            "commission": "0.06598253",            "commissionAsset": "USDT",            "tradeId": 3570680726        }    ],  "isIsolated": false,  "selfTradePreventionMode": "EXPIRE_MAKER"}