Binance Spot launched the Time-Weighted Average Price (TWAP) trading algorithm for API users. Using Binance's in-house algorithmic trading capability, users can disperse large orders into smaller quantities and execute them at regular intervals automatically to minimize price impact.
What is a TWAP algorithm?
Time-Weighted Average Price (TWAP) is an algorithmic trade execution strategy. It aims to achieve an average execution price close to the time-weighted average price of a specific period.
When to use a TWAP algorithm?
Traders usually deploy TWAP to mitigate the market impact for large orders. TWAP trading algorithms aim to optimize a trade’s average price by slicing order execution over a specific time duration.
TWAP is favored to provide a better execution price in the following scenarios:
- When the order size is larger than the available liquidity on the order book.
- In anticipation of a high-price volatility period with no clear up or downward trend.
Here is an example of TWAP algorithm execution patterns:

What do I need to consider when setting up a TWAP strategy?
- Determine the trade size (the total amount of crypto you want to buy or sell). The minimum allowed TWAP strategy trade size is equivalent to 1,000 USDT on Binance. When a TWAP strategy completes all orders, the TWAP order will stop.
- Choose the targeted TWAP execution period. You can select between 5 minutes and 24 hours on Binance Spot.
TWAP algorithm API details
New TWAP order endpoint:
Customizable execution parameters
Parameters | Description |
symbol | Trading symbol (e.g., BTCUSDT) |
side | Trading side (e.g., BUY or SELL) |
quantity | Trading quantity (must be between 1,000 USDT and 100,000 USDT equivalent) |
duration | TWAP order duration in seconds (300 or 86,400)
|
limitPrice | TWAP order’s limit price (The order will be placed at market price by default) |
Other supplementary endpoints
Endpoint | Description | Link |
DELETE /sapi/v1/algo/spot/order | Cancel an active order | https://binance-docs.github.io/apidocs/spot/en/#cancel-algo-order-trade-2 |
GET /sapi/v1/algo/spot/openOrders | Get all running orders | https://binance-docs.github.io/apidocs/spot/en/#query-current-algo-open-orders-user_data-2 |
GET /sapi/v1/algo/spot/historicalOrders | Get historical orders | https://binance-docs.github.io/apidocs/spot/en/#query-historical-algo-orders-user_data-2 |
GET /sapi/v1/algo/spot/subOrders | Get respective sub orders for a specified algo ID | https://binance-docs.github.io/apidocs/spot/en/#query-sub-orders-user_data-2 |
Frequently Asked Questions
1. What are the order limits?
- Open Order Limit: TWAP supports up to 10 simultaneously running orders per account. You can place multiple TWAP orders for the same symbol.
- Notional Limit: The notional (Order Quantity * Last Price (base asset)) must be more than or equal to (≥) 1,000 USDT equivalent, and less than or equal to (≤) 100,000 USDT equivalent.
- Duration: Duration cannot be shorter than 5 minutes (300 seconds) or longer than 24 hours (86,400 seconds).
Transaction details won’t be available until all TWAP orders are filled. Only partially completed orders will be displayed. You can view the transaction quantity, average transaction price, and trading fee.
2. What do the error responses mean?
You may receive the following error responses following an inadequate query.
External code | External message |
0 | OK |
-1000 | An unknown error occurred while processing the request |
-1102 | A mandatory parameter was not sent, empty/null, or malformed |
-20121 | Invalid symbol |
-20130 | Invalid data sent for a parameter |
-2013 | Order does not exist |
-5007 | Quantity must be greater than zero |
-20124 | Invalid algo ID, or the algo ID has been completed |
-20132 | The client algo ID is duplicated |
-20194 | Duration is too short to execute all required quantity |
-20195 | The total size is too small |
-20196 | The total size is too large |
-20198 | You’ve reached the max open orders allowed |
3. Do TWAP orders guarantee execution?
TWAP orders do not guarantee execution. Orders will be filled with the best effort, subject to market liquidity and volatility.
If the market price moves considerably or liquidity is insufficient during order execution, the algorithm may not be able to execute all orders fully.
Thus, execution is and will always be liquidity-dependent with no guarantee for best price execution. For example, the algorithm may fail to complete the order before the specified end time if the market becomes distressed.
Binance employs multiple risk mitigation strategies, including manual and automated circuit breakers and kill-switch controls. These features can activate in the event of market disruption and/or systems failure, canceling any TWAP order early when they’re not fully filled.
4. How to check the status of my TWAP orders?
To check the status of a TWAP order, you can use the query order endpoints (GET /sapi/v1/algo/spot/openOrders or GET /sapi/v1/algo/spot/historicalOrders).
Please note:
- You won’t receive any WebSocket notification for order filling updates.
- Receiving ["success": true] does not mean that your order will be executed. For example, if your Spot Wallet balance is insufficient, you’ll receive ["success": true], but the order will still fail to execute.