Skip to main content

Close All Positions

  • POST /capi/v2/order/closePositions

Weight(IP): 40, Weight(UID): 50

Request parameters

ParameterTypeRequired?Description
symbolStringNoTrading pair. If not provided, all positions will be closed at market price

Request example

curl -X POST "https://api-contract.weex.com/capi/v2/order/closePositions" \
-H "ACCESS-KEY:*******" \
-H "ACCESS-SIGN:*" \
-H "ACCESS-PASSPHRASE:*" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:zh-CN" \
-H "Content-Type: application/json" \
-d '{"symbol": "cmt_btcusdt"}'

Response parameters

ParameterTypeDescription
positionIdLongPosition ID
successBooleanWhether the position was successfully closed
successOrderIdLongOrder ID if successful (0 if failed)
errorMessageStringError message if the close position failed

Response example

[
{
"positionId": 690800371848708186,
"successOrderId": 696023766399976282,
"errorMessage": "",
"success": true
}
]