TWAP Orders
TWAP (Time-Weighted Average Price) orders split a large order into smaller slices executed evenly over a time window. This helps reduce market impact by spreading execution rather than placing one large order at once.
How It Works
- You submit an order with
algo_type: "twap", specifying the total amount, how long to execute over (algo_duration_sec), and how many slices (algo_num_slices). - The system divides your order into equal slices and executes one market IOC order at each interval.
- If earlier slices don't fully fill (e.g. due to thin liquidity), later slices automatically increase in size to catch up — capped at 2x the base slice size to limit impact.
- Once the time window expires, the order finalizes. If fully filled, the status is
filled. If only partially filled, the status iscancelledwith reasonalgo_completed.
Parameters
| Parameter | Description | Constraints |
|---|---|---|
algo_type | Algorithm type | "twap" |
algo_duration_sec | Total execution window in seconds | 60 – 86,400 (24 hours) |
algo_num_slices | Number of slices to split the order into | 2 – 1,000 |
order_type | Must be "market" | — |
time_in_force | Must be "ioc" | — |
The minimum interval between slices is 10 seconds (algo_duration_sec / algo_num_slices >= 10).
Limits
- Up to 5 active TWAP orders per subaccount.
- TWAP orders cannot be amended — only cancelled and re-submitted.
- MMP is not supported for TWAP orders.
Cancellation
- Cancel a single order with
private/cancel_algo_order. - Cancel all active TWAP orders with
private/cancel_all_algo_orders.
Tracking Progress
Order updates are streamed on the {subaccount_id}.orders WebSocket channel. Key fields to monitor:
algo_slices_completed— how many slices have executed so faralgo_num_slices— total slicesfilled_amount— cumulative amount filled across all slicesstatus—algo_activewhile running,filledorcancelledwhen done
Example
To sell 100 ETH-PERP over 10 minutes in 20 slices:
{
"instrument_name": "ETH-PERP",
"direction": "sell",
"order_type": "market",
"time_in_force": "ioc",
"amount": "100",
"algo_type": "twap",
"algo_duration_sec": 600,
"algo_num_slices": 20
}