Encyclopedia DeFi · Entry 161
TWAP oracles: averaging prices over time
In this article
At a glance
Key facts
| Fact | Detail | Source |
|---|---|---|
| V2 example | Uniswap v2 accumulates prices to support arithmetic time-weighted averages. | [1] |
| V3 example | Uniswap v3 accumulates ticks to support geometric mean prices. | [2] |
| Window | The selected interval changes responsiveness and the exposure being measured. | [1][2] |
Weight by time rather than number of trades
For a simple arithmetic example, a price of 100 for 30 minutes and 120 for 30 minutes gives a one-hour average of 110. Ten trades at one moment should not automatically receive ten times the time weight.
This example is not the geometric method used by a v3 tick-based oracle. Name the averaging convention when comparing outputs.
Subtract two observations and divide by elapsed time
A cumulative price records price multiplied by elapsed time. The difference between observations gives an interval total that can be divided by the interval length.
An application must have suitable observations spanning the intended window. A requested duration is not proof that enough trustworthy history is available.
Smoothing trades immediacy for a longer measurement
A longer interval can reduce sensitivity to brief moves but responds more slowly to a genuine market change. Pool depth and an attacker’s ability to sustain a distortion affect manipulation economics.
Using a TWAP does not automatically make a lending or settlement application safe. Match the source liquidity and window to the use case and failure handling.
Direct answers
Questions people ask
Are all TWAP values calculated the same way?
No. Arithmetic and geometric approaches differ, as do observation windows and sources. Uniswap v2 and v3 illustrate why the exact method must be identified.
Inspect the evidence
The answer and key facts have stable claim links. These records retain the scope and qualification when reused.
A time-weighted average price, or TWAP, averages price observations over an interval according to time spent at each value. It can reduce dependence on one instantaneous pool price, but introduces lag and does not eliminate manipulation risk. The pool, window, observation availability and averaging method all matter.
Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.
Link to this claimV2 example: Uniswap v2 accumulates prices to support arithmetic time-weighted averages.
Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.
Link to this claimV3 example: Uniswap v3 accumulates ticks to support geometric mean prices.
Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.
Link to this claimWindow: The selected interval changes responsiveness and the exposure being measured.
Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.
Link to this claimRevision history
- — First publication after primary-source research and independent automated verification.
Source register
Sources and references
Retrieval dates and locators are recorded individually.- Uniswap v2 whitepaperUniswap
Full-range constant-product inventory and cumulative-price oracle design.
Locator: Price oracle; Liquidity; Fees · Version / scope: Uniswap v2 whitepaper, March 2020 · Retrieved: 2026-10-02T17:03:45.008ZOpen source - Uniswap v3 whitepaperUniswap
Range-based positions and oracle time accumulation.
Locator: Concentrated Liquidity; Oracle · Version / scope: Uniswap v3 whitepaper, March 2021 · Retrieved: 2026-10-02T17:03:45.213ZOpen source
Research and drafting use AI assistance. A separate automated review checks claims against primary sources; no external expert or named human review is implied. Publication, substantive editing, source retrieval and verification are recorded separately. This version was independently checked by an automated reviewer on 2 October 2026.
Editorial method and correctionsDegrees of Satoshi editorial project. “TWAP oracles: averaging prices over time.” Published 2026-10-02; updated 2026-10-02. https://degreesofsatoshi.com/encyclopedia/twap-oracles/