Rate Limit: 3 requests per 10 seconds
Tip:
You can create order by websocket after login.
Request
TPSL/ATTACHED_TPSL
{
"id": "ws-1735611102",
"action": "place_algo_order",
"args": {
"clientOrderId": "2024123110114200",
"algoOrderType": "TPSL",
"sym": "OKX_PERP_ETH_USDT",
"side": "BUY",
"orderQty": "0.1",
"positionSide": "LONG",
"conditionType": "CONDITIONAL",
"conditionalTriggerPrice": "1000",
"conditionalTriggerPriceType": "LAST_PRICE",
"conditionPrice": "0"
}
}
TWAP/VWAP
{
"id": "ws-1735611102",
"action": "place_algo_order",
"args": {
"clientOrderId": "XXX",
"algoProvider": "ABEX",
"algoOrderType": "TWAP",
"sym": "OKX_PERP_ETH_USDT",
"side": "BUY",
"orderQty": "0.04",
"limitPrice": "2000",
"startTime": "1736401191256",
"endTime": "1736404791256",
"interval": "5"
}
}
Field name | Type | Necessary | Remarks |
---|---|---|---|
id | String | N | client request id |
action | String | Y | place_algo_order |
args | Object | Y | request params |
> clientOrderId | String | N | Customer defined order ID ,only support letters(a-z) and numbers(0-9) |
> algoOrderType | String | Y | Algo order types: TWAP, VWAP, TPSL, ATTACHED_TPSL |
> algoProvider | String | N | ABEX; Optional for TPSL and ATTACHED_TPSL |
> sym | String | Y | Sym(unique identifier:Exchange_Business_Base_Counter. Example: If you want to place a SPOT order for the BTC/USDT trading pair on the Binance exchange, you can use a unique identifier like this: "BINANCE_SPOT_BTC_USDT" ; If you want to place a PERPETUAL order for the BTC/USDT trading pair on the Binance exchange, you can use a unique identifier like this: "BINANCE_PERP_BTC_USDT" ; ) Note that we currently only support the SPOT and PERPETUAL trade of Binance and OKX. |
> side | String | N | Side(BUY, SELL) |
> limitPrice | String | N | Limit order price(Mandatory for limit order) |
> orderQty | String | N | 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 |
> positionSide | String | N | Position side, NONE/LONG/SHORT , default NONE . NONE stands for one-way mode. |
> reduceOnly | String | N | Reduce position orders only, must "true" or "false" |
TP/SL
Field name | Type | Necessary | Remarks |
---|---|---|---|
conditionType | String | Y | CONDITIONAL, OCO, ENTIRE_CLOSE_POSITION, PARTIAL_CLOSE_POSITION |
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. |
orderType | String | N | Order type(default LIMIT, support type enums:LIMIT,MARKET); only for ATTACHED_TSPL |
timeInForce | String | N | TimeInForce (default GTC, support type enums:GTC,IOC,FOK,GTX), GTX = GTC + Post only; only for ATTACHED_TSPL |
quoteOrderQty | String | N | Order quote quantity, only use for spot market buy order; only for ATTACHED_TSPL |
TWAP/VWAP
Field name | Type | Necessary | Remarks |
---|---|---|---|
startTime | String | Y | Start time , unit of milisecond, must earlier than current time |
endTime | String | Y | "End time , unit of milisecond, must later than start time, and end time - start time < 24 hours" |
interval | String | Y | Unit of second |
Response
Success example:
{
"id": "XXXX", // request id
"event": "place_algo_order",
"code": "0",
"msg": "",
"data": {
"algoOrderId": "XXXXX",
"clientOrderId": "XXXXX",
"orderId": "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 |
> orderId | String | Order ID; only for ATTACHED_TSPL |