Place Algo Order

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

FieldTypeRequiredDescription
idStringNClient-defined request ID. Echoed back in the response so you can match requests to responses.
actionStringYMust be place_algo_order.
argsObjectYOrder parameters.
> clientOrderIdStringNYour own order ID. Only lowercase letters (a-z) and digits (0-9).
> algoOrderTypeStringYTPSL, TWAP, or VWAP.
> algoProviderStringNABEX. Required for TWAP/VWAP orders.
> symStringYTrading pair in Exchange_BusinessType_Base_Counter format. Supported: SPOT and PERP on Binance and OKX.
> sideStringYBUY or SELL.
> orderQtyStringNOrder quantity. Required unless placing a spot market buy. OKX: number of contracts. Binance: coin amount.
> limitPriceStringNLimit price. Used for TWAP/VWAP orders.
> positionSideStringNNONE for one-way mode (default). LONG or SHORT for hedge mode.
> reduceOnlyStringN"true" or "false". When "true", the order can only reduce an existing position. For derivatives only.

TPSL-Specific Parameters

FieldTypeRequiredDescription
> conditionTypeStringYCONDITIONAL (single trigger), OCO (one-cancels-the-other), ENTIRE_CLOSE_POSITION, or PARTIAL_CLOSE_POSITION.
> conditionalTriggerPriceStringNPrice at which the conditional order activates.
> conditionalTriggerPriceTypeStringNPrice type for the conditional trigger: LAST_PRICE or MARK_PRICE.
> conditionalPriceStringNLimit price after the trigger fires. "0" means execute at market price.
> tpTriggerPriceStringNTake-profit trigger price. When the market reaches this price, the take-profit order is submitted.
> tpTriggerTypeStringNPrice type for the take-profit trigger: LAST_PRICE or MARK_PRICE (default: LAST_PRICE).
> tpPriceStringNTake-profit execution price. "0" means execute at market price.
> slTriggerPriceStringNStop-loss trigger price. When the market reaches this price, the stop-loss order is submitted.
> slTriggerTypeStringNPrice type for the stop-loss trigger: LAST_PRICE or MARK_PRICE (default: LAST_PRICE).
> slPriceStringNStop-loss execution price. "0" means execute at market price.

TWAP / VWAP-Specific Parameters

FieldTypeRequiredDescription
> startTimeStringYExecution start time as a Unix timestamp in milliseconds. Must be a future time.
> endTimeStringYExecution end time as a Unix timestamp in milliseconds. Duration must be more than 60 seconds and less than 24 hours.
> intervalStringYInterval 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: 0 means LTP has accepted the algo order. Monitor the ALGO_ORDER push channel for state changes (NEWPROCESSINGCOMPLETED / CANCELLED).

FieldTypeDescription
idStringEchoed client request ID.
eventStringplace_algo_order on success, error on failure.
codeLong0 = order accepted. Any other value indicates an error — check msg for the reason.
msgStringEmpty on success, or an error message on failure.
dataObjectPresent on success only.
> algoOrderIdStringLTP-assigned algo order ID. Use this for cancel or replace requests.
> clientOrderIdStringEchoed from the request. Empty if clientOrderId was not provided.