Submit a new algorithmic order over the authenticated algo WebSocket connection. Supported types are TPSL (Take Profit / Stop Loss), TWAP (Time Weighted Average Price), and VWAP (Volume Weighted Average Price). The response confirms LTP has accepted the order — monitor the ALGO_ORDER push channel for status updates.
Rate Limit: 3 requests per 10 seconds
Request
The required parameters differ by algo order type. See examples and parameter tables below.
TPSL Example
{
"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 Example
{
"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"
}
}
Core Parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | String | N | Client-defined request ID. Echoed back in the response so you can match requests to responses. |
action | String | Y | Must be place_algo_order. |
args | Object | Y | Order parameters. |
> clientOrderId | String | N | Your own order ID. Only lowercase letters (a-z) and digits (0-9). |
> algoOrderType | String | Y | TPSL, TWAP, or VWAP. |
> algoProvider | String | N | ABEX. Required for TWAP/VWAP orders. |
> sym | String | Y | Trading pair in Exchange_BusinessType_Base_Counter format. Supported: SPOT and PERP on Binance and OKX. |
> side | String | Y | BUY or SELL. |
> orderQty | String | N | Order quantity. Required unless placing a spot market buy. OKX: number of contracts. Binance: coin amount. |
> limitPrice | String | N | Limit price. Used for TWAP/VWAP orders. |
> positionSide | String | N | NONE for one-way mode (default). LONG or SHORT for hedge mode. |
> reduceOnly | String | N | "true" or "false". When "true", the order can only reduce an existing position. For derivatives only. |
TPSL-Specific Parameters
| Field | Type | Required | Description |
|---|---|---|---|
> conditionType | String | Y | CONDITIONAL (single trigger), OCO (one-cancels-the-other), ENTIRE_CLOSE_POSITION, or PARTIAL_CLOSE_POSITION. |
> conditionalTriggerPrice | String | N | Price at which the conditional order activates. |
> conditionalTriggerPriceType | String | N | Price type for the conditional trigger: LAST_PRICE or MARK_PRICE. |
> conditionalPrice | String | N | Limit price after the trigger fires. "0" means execute at market price. |
> tpTriggerPrice | String | N | Take-profit trigger price. When the market reaches this price, the take-profit order is submitted. |
> tpTriggerType | String | N | Price type for the take-profit trigger: LAST_PRICE or MARK_PRICE (default: LAST_PRICE). |
> tpPrice | String | N | Take-profit execution price. "0" means execute at market price. |
> slTriggerPrice | String | N | Stop-loss trigger price. When the market reaches this price, the stop-loss order is submitted. |
> slTriggerType | String | N | Price type for the stop-loss trigger: LAST_PRICE or MARK_PRICE (default: LAST_PRICE). |
> slPrice | String | N | Stop-loss execution price. "0" means execute at market price. |
TWAP / VWAP-Specific Parameters
| Field | Type | Required | Description |
|---|---|---|---|
> startTime | String | Y | Execution start time as a Unix timestamp in milliseconds. Must be a future time. |
> endTime | String | Y | Execution end time as a Unix timestamp in milliseconds. Duration must be more than 60 seconds and less than 24 hours. |
> interval | String | Y | Interval between each execution slice, in seconds. |
Response
Success:
{
"id": "XXXX",
"event": "place_algo_order",
"code": 0,
"msg": "",
"data": {
"algoOrderId": "XXXXX",
"clientOrderId": "XXXXX"
}
}
Failure:
{
"id": "***",
"event": "error",
"code": "60009",
"msg": "Create order failed."
}
code: 0means LTP has accepted the algo order. Monitor theALGO_ORDERpush channel for state changes (NEW→PROCESSING→COMPLETED/CANCELLED).
| Field | Type | Description |
|---|---|---|
id | String | Echoed client request ID. |
event | String | place_algo_order on success, error on failure. |
code | Long | 0 = order accepted. Any other value indicates an error — check msg for the reason. |
msg | String | Empty on success, or an error message on failure. |
data | Object | Present on success only. |
> algoOrderId | String | LTP-assigned algo order ID. Use this for cancel or replace requests. |
> clientOrderId | String | Echoed from the request. Empty if clientOrderId was not provided. |
