A time-weighted average price (TWAP) is an average that gives each price level weight according to how long it remained in effect during a chosen interval. In decentralized finance, TWAP can refer to an on-chain oracle calculation. Traders also use “TWAP” for an execution strategy that divides a large order into timed smaller orders. These are related ideas, but one reports a price and the other schedules trades.
How an oracle TWAP works
A simple time average is the accumulated price over the observation window divided by its duration. Uniswap v2 records cumulative prices, allowing a caller to compare two observations and calculate an average for the interval. The result depends on which pool, token direction, and time window the caller selects.
Uniswap v3 stores cumulative ticks. A consumer calculates an arithmetic mean tick for the interval and converts that tick to a price; because tick spacing is logarithmic, this corresponds to a geometric mean price rather than a simple arithmetic mean of spot prices. The versions therefore do not expose exactly the same averaging mechanics.
Oracle versus execution strategy
A TWAP execution strategy slices an order across time—for example, submitting smaller trades at set intervals—to reduce the immediate market impact of one large order. It does not promise a better average fill. Price movement, liquidity, fees, slippage, and adverse selection may make the result worse than a single trade or a different execution plan.
An oracle TWAP is a price signal consumed by a smart contract. It is not itself a trade and should not be treated as a guaranteed fair market price. Protocol designers must assess the chosen pool, observation window, update timing, liquidity, and how the value is combined with other safeguards.
Manipulation and delay
A longer averaging window can make short-lived price manipulation more expensive in a sufficiently liquid pool, but TWAPs are not manipulation-proof. Thin liquidity, sustained price moves, network conditions, and the value at stake all matter. A longer window also reacts more slowly to genuine price changes, which can be dangerous for lending or liquidation rules.
TWAP is one tool, not a complete oracle-security design. Applications may need liquidity checks, bounds, multiple sources, stale-data handling, and emergency controls. No fixed window is safe for every asset or protocol.
Social Media Sentiment
A May 2025 r/ethereum thread discusses CoW Swap’s TWAP order feature as a way to split a large trade over time, including a question about price protection. It is an example of execution-strategy discussion; it does not establish the security of TWAP oracles. Reddit discussion. This is one public thread, not a representative survey.
Last updated: 2026-10
Related Terms
See Also
- What Is MEV on Ethereum?
- Are Layer 2 Networks Decentralized?
- Does Ethereum TPS Include Layer 2 Transactions?
- Exchange crypto with ChangeNOW
Sources
- Uniswap Developers: Uniswap v2 Oracles — Explains cumulative prices, observation windows, TWAP calculation, and the role of pool liquidity in manipulation costs.
- Uniswap Developers: Uniswap as a Price Oracle — Shows how v3 cumulative ticks are averaged and converted into a time-weighted price.
- Uniswap Developers: Building an Oracle — Discusses choosing observation intervals and implementing a v2 TWAP oracle.