API Reference

Replace Algo Order

Rate Limit: 3 requests per 10 seconds

Tip:
You can create order by websocket after login.

Request

TPSL

{
    "id": "ws-1735611102",
    "action": "replace_algo_order",
    "args": {
        "algoOrderId": "",
        "clientOrderId": "1737615509395024000",
        "orderQty": "0.01",
        "conditionalTriggerPrice": "",
        "conditionalTriggerType": "",
        "conditionalPrice": "",
        "tpTriggerPrice": "632",
        "tpTriggerType": "MARK_PRICE",
        "tpPrice": "732.1",
        "slTriggerPrice": "742",
        "slTriggerType": "LAST_PRICE",
        "slPrice": "0"
    }
}
Field nameTypeNecessaryRemarks
idStringNclient request id
actionStringYplace_algo_order
argsObjectYrequest params
> algoOrderIdStringNAlgo order ID
> clientOrderIdStringNCustomer defined order ID ,only support letters(a-z) and numbers(0-9)
> orderQtyStringNAlgo order quantity(Mandatory, unless spot market buy ) note: trading unit of OKX is the number of contracts/ trading unit of Binance is the number of coin

TP/SL

Field nameTypeNecessaryRemarks
conditionalTriggerPriceStringNConditional Order Trigger Price
conditionalTriggerPriceTypeStringNConditional Order Trigger Price Type:
LAST_PRICE, MARK_PRICE
conditionalPriceStringNLimit Price After Triggering Conditional Order ;
0 Indicates Market Price.
tpTriggerPriceStringNTake-profit trigger price.
tpTriggerTypeStringNTake-profit trigger price type
LAST_PRICE, MARK_PRICE
The default is LAST_PRICE
tpPriceStringNTake-profit order price.
If the price is 0, take-profit will be executed at the market price.
slTriggerPriceStringNStop-loss trigger price.
slTriggerTypeStringNStop-loss trigger price type
LAST_PRICE, MARK_PRICE
The default is LAST_PRICE
slPriceStringNStop-loss order price.
If the price is 0, stop-loss will be executed at the market price.

Response

Success example:

{
  "id": "XXXX", // request id
  "event": "replace_algo_order",  
  "code": "200000",  
  "msg": "",
  "data": {
    "algoOrderId": "XXXXX",
    "clientOrderId": "XXXXX"
  }
}

Fail example:

{  
  "id":"***", 
  "event": "error",  
  "code": "60009",  
  "msg": "Create order failed."  
}
Field nameTypeRemarks
idStringClient request id
eventStringEvent
codeStringCode
msgStringMsg
dataObjectResponse data
> algoOrderIdStringAlgo order ID
> clientOrderIdStringCustomer defined order ID