Overview
TWAP (Time-Weighted Average Price) orders enable you to split a large trade into smaller parts that execute at regular intervals. This strategy helps:
- Reduce Price Impact — Avoid moving the market with large orders
- Minimize Slippage — Spread execution risk over time
- Dollar-Cost Averaging — Average out price fluctuations
- Stealth Trading — Execute large positions without revealing full intent
TWAP orders are implemented as composable programmatic orders on the ComposableCoW framework.
Creating a TWAP Order
TWAP Parameters
Token Configuration
Timing Configuration
Start Types
AT_MINING_TIME
The TWAP starts when the order creation transaction is mined:
AT_EPOCH
Schedule the TWAP to start at a specific time:
Duration Types
AUTO Duration
Each part is valid until the next part starts:
LIMIT_DURATION
Set a custom validity period for each part:
The duration_of_part must be less than or equal to time_between_parts or the order will be invalid.
Submitting a TWAP Order
Monitoring TWAP Execution
TWAP Status and Validation
Canceling a TWAP
Serialization
Complete Example
Best Practices
- Choose Appropriate Part Counts: 5-20 parts is typically optimal for mainnet. More parts = better averaging but higher gas.
- Set Realistic Price Limits: The
buy_amount is divided across all parts. Ensure each part’s limit price is achievable.
- Consider Market Hours: Schedule TWAPs during liquid trading periods.
- Monitor Cabinet Storage: For
AT_MINING_TIME orders, check authorization before polling.
- Test on Testnets: Always test TWAP strategies on Sepolia first.