TWAP API
TWAP (Time-Weighted Average Price) orders split transactions into multiple parts executed at regular intervals, helping traders achieve better average prices.
Key Parameters
Core Function
The getTradeableOrder() function returns the currently executable order portion. It:
- Decodes input data
- Retrieves the start time if needed from protocol storage
- Generates the appropriate order for the present moment
- Confirms it remains within valid timeframes
Validation Requirements
Orders fail validation when:
- Tokens are identical
- Either token is zero-addressed
- Sell amounts equal zero
- Price limits are zero
- Timing parameters exceed allowed ranges
span exceeds interval frequency
- Execution windows have expired
The system ensures each order segment has a unique identifier, preventing accidental duplicate settlements.
Technical Notes
- TWAP orders function as non-partial sells with zero fees
- The protocol itself manages fee distribution
- Each execution segment receives its own expiration timestamp, creating distinct order identifiers across the entire sequence
Last modified on March 12, 2026