Batch Close Positions

Permission

  • Primary API Key: TRADE, batch close positions of main portfolio
  • Sub-Portfolio API Key: TRADE, batch close positions of current portfolio

Need to cancel all open orders before calling this endpoint to batch close existing positions.

Rate Limit

  • 4 requests per 10 seconds

Note

  • Close Positions API is designed for the instant position close purpose, which is usually to make sure no more positions will be there after the call.
  • The standard process to use this endpoint is to :
    1. cancell all open order
    2. close positions
  • close positions API is only for market orders to close. To close an position with limit order, please place limit order with 【reduceonly】


Request

NameTypeMandatoryDescription
symListStringNTrading pair unique identifier , Support up to 20 pairs, separated by "," .
example: BINANCE_PERP_BTC_USDT, OKX_PERP_BTC_USDT.
symList can't be empty if closeAllPos=false.
positionSideStringNNONE / LONG / SHORT. NONE stands for one-way mode position. Unable to close positions if NONE passed , when the account mode is two-ways (BOTH) mode. If your positionMode is both, positionSide must be LONG or SHORT
closeAllPosStringNtrue / false. default false. In false case, symList mustn't be empty. In true case, ignore symList and close all open positions in specific exchange
exchangeTypeStringNOKX / BINANCE. empty to close all exchange positions. Only applies to closeAllPos = true.

Respone

Field nameTypeRemarks
symStringTrading pair unique identifier ,
example: BINANCE_PERP_BTC_USDT, OKX_PERP_BTC_USDT
orderIdStringorderId, if cannot close position, it don't have orderId
positionSideStringNONE / LONG / SHORT
orderIdStringorder id to close the current sym
successStringtrue / false. where it is able to issue an order to close the current sym
errorMsgStringerror message if unable to issue an order to close the current sym
Language