Trade

Market Close Position

This endpoint supports the closing of orders in USDT futures via Market sell.

HTTP Request

POST /v1/trade/market-close-position

NOTE

Don't include trailing slash / at the end of the endpoint. Doing so can result in a “not found” error.

Request Parameters

ParameterRequiredTypeComments
idtruenumberid of the position
sizetruenumbersize of the position
coinfalsestringValues:
  • BTCUSDT, ETHUSDT, SOLUSDT, XRPUSDT 1000PEPEUSDT, WLDUSDT, DOGEUSDT,
  • STPTUSDT, SUIUSDT, ADAUSDT, ARBUSDT, XLMUSDT, HIVEUSDT, ONDOUSDT

Response Parameters

ParameterTypeComments
statusCodenumber200
resultstringSuccess
messagestringPosition closed successfully!
ParameterTypeComments
statusCodenumber404
resultstringNot Found
messagestringPosition not found!

INFO

The ack of market close position indicates that the request is successfully accepted. Please use websocket order stream to confirm the status.

Request Example

POST /v1/trade/market-close-position HTTP/1.1
Host: api.okxai.net
X-OKXAI-SIGN: XXXXX
X-OKXAI-API-KEY: XXXXX
Content-Type: application/json
 
{
  "id": 456, 
  "size": 0.5, 
  "coin": "BTCUSDT", 
}

Response Example

{
  "statusCode": 200,
  "result": "Success",
  "message": "Position closed successfully!",
}

On this page