API Reference

Place Algo Order

Rate Limit: 3 requests per 10 seconds

Tip:
You can create order by websocket after login.

Request

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 nameTypeNecessaryRemarks
idStringNclient request id
actionStringYplace_algo_order
argsObjectYrequest params
> clientOrderIdStringNCustomer defined order ID ,only support letters(a-z) and numbers(0-9)
> algoOrderType StringYAlgo order types: TWAP, VWAP, TPSL
> algoProviderStringNABEX; Optional for TPSL
> symStringYSym(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.
> sideStringNSide(BUY, SELL)
> limitPriceStringNLimit order price(Mandatory for limit order)
> 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
> positionSideStringNPosition side, NONE/LONG/SHORT, default NONE. NONE stands for one-way mode.
> reduceOnlyStringNReduce position orders only, must "true" or "false"

TP/SL

Field nameTypeNecessaryRemarks
conditionTypeStringYCONDITIONAL, OCO, ENTIRE_CLOSE_POSITION, PARTIAL_CLOSE_POSITION
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.

TWAP/VWAP

Field nameTypeNecessaryRemarks
startTimeStringYStart time , unit of milisecond, must be later than current time
endTimeStringYEnd time , unit of milisecond, must be later than start time.
And end time - start time > 60 seconds, end time - start time < 24 hours.
intervalStringYUnit of second

Response

Success example:

{ "id": "XXXX", // request id "event": "place_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