Endpoint
Request Body
| Parameter | Type | Description |
|---|---|---|
action* | object | See below |
action.type* | string | Must be "twapOrder" |
action.asset* | string | 8-char HL_Perp or HL_SpotPair AssetId hex string |
action.isBuy* | boolean | true for buy, false for sell |
action.sz* | string | Total TWAP size |
action.reduceOnly* | boolean | Reduce-only execution for perps; must be false for spot |
action.durationMinutes* | number | Total schedule duration in minutes |
action.numSlices* | number | Number of TWAP suborders to schedule |
action.randomize* | boolean | Whether to randomize suborder timing within the schedule |
nonce* | number | Replay-protection nonce |
expiresAfter | number | Optional expiration timestamp in ms |
signature* | object | EIP-712 signature |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
response.data.status | "pending" | "rejected" | pending means the TWAP was accepted into the event pipeline |
response.data.twapOrderId | string | undefined | Deterministic TWAP id, present on accepted requests |
response.data.error | string | undefined | Rejection reason when the request reaches handler logic but fails |
Example Request
Perp TWAP:HL_SpotPair asset id, not the raw HL_Spot token asset id:
Notes
twapOrderIdis deterministic from the signed request transaction id. - Schedules must satisfy the current suborder interval bounds enforced by Notional: minimum 10 seconds and maximum 10 minutes between suborders. - Perp TWAPs validate current mark price, first-suborder margin, and minimum suborder notional before acceptance. - Spot TWAPs validate the spot pair’s base token price, first-suborder source balance, and minimum suborder notional before acceptance. Spot buys use the existing protocol spot-prefund flow for each slice. - Reduce-only TWAPs are perp-only and are checked against the remaining closable size after existing reduce-only orders and active TWAP reservations. - Accepted TWAPs begin withresponse.data.status: "pending"and then progress throughtwapListActive,twapListHistory, and WebSockettwapUpdates.
