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 name | Type | Necessary | Remarks |
|---|---|---|---|
| id | String | N | client request id |
| action | String | Y | place_algo_order |
| args | Object | Y | request params |
| > algoOrderId | String | N | Algo order ID |
| > clientOrderId | String | N | Customer defined order ID ,only support letters(a-z) and numbers(0-9) |
| > orderQty | String | N | Algo 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 name | Type | Necessary | Remarks |
|---|---|---|---|
| conditionalTriggerPrice | String | N | Conditional Order Trigger Price |
| conditionalTriggerPriceType | String | N | Conditional Order Trigger Price Type: LAST_PRICE, MARK_PRICE |
| conditionalPrice | String | N | Limit Price After Triggering Conditional Order ; 0 Indicates Market Price. |
| tpTriggerPrice | String | N | Take-profit trigger price. |
| tpTriggerType | String | N | Take-profit trigger price type LAST_PRICE, MARK_PRICE The default is LAST_PRICE |
| tpPrice | String | N | Take-profit order price. If the price is 0, take-profit will be executed at the market price. |
| slTriggerPrice | String | N | Stop-loss trigger price. |
| slTriggerType | String | N | Stop-loss trigger price type LAST_PRICE, MARK_PRICE The default is LAST_PRICE |
| slPrice | String | N | Stop-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 name | Type | Remarks |
|---|---|---|
| id | String | Client request id |
| event | String | Event |
| code | String | Code |
| msg | String | Msg |
| data | Object | Response data |
| > algoOrderId | String | Algo order ID |
| > clientOrderId | String | Customer defined order ID |
