Trade

Set TPSL

This endpoint supports the setting of take profit and stop loss (TP/SL).

HTTP Request

POST /v1/trade/set-tpsl

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
tpPricefalsenumbertake profit price of the position
slPricefalsenumberstop loss price of the position

Response Parameters

ParameterTypeComments
statusCodenumber200
resultstringSuccess
messagestringTPSL set successfully!
ParameterTypeComments
statusCodenumber404
resultstringNot Found
messagestringPosition not found!

INFO

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

Request Example

POST /v1/trade/set-tpsl 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, 
  "tpPrice": 55000.00, 
  "slPrice": 45000.00, 
}

Response Example

{
  "statusCode": 200,
  "result": "Success",
  "message": "TPSL set successfully!",
}

On this page