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
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: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_amountis 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_TIMEorders, check authorization before polling. - Test on Testnets: Always test TWAP strategies on Sepolia first.
Related Resources
- Composable Orders — Learn about the ConditionalOrder framework
- Multi-Chain Trading — Execute TWAPs across different chains
- Managing Orders — Create and manage orders via API