Skip to main content
TWAP orders split a large open or close into slices executed over run_time_seconds. Useful when a single fill would eat too much spread or exceed available liquidity. The SDK signs a TWAP intent (EIP-712) and submits it to the Avantis TWAP API, which registers the order on-chain itself and responds synchronously. The receipt carries the transaction hash and the on-chain twapId in receipt.order_id. TWAP is not available on Upside pairs (their TWAP params are zeroed on-chain); twap_open/twap_close raise a ValidationError (UPSIDE_MARKET_ONLY) on them.

Open

Each slice must clear the pair’s minimum position size (PairInfo.min_lev_pos_usdc in notional). Too little collateral over too long a run time fails with BelowMinPosition. Check pair.twap_params (min/max run time, frequency, fee) before sizing.

Close

List and cancel

Cancelling signs a TwapCancelReq intent over the twapId. The trader key or an active delegate key both work.