{
  "$schema": "https://degreesofsatoshi.com/encyclopedia/schemas/article-v1.json",
  "schemaVersion": "1.0.0",
  "id": "twap-oracles",
  "canonical": "https://degreesofsatoshi.com/encyclopedia/twap-oracles/",
  "collection": "defi",
  "title": "TWAP oracles: averaging prices over time",
  "description": "Understand time-weighted average prices, distinguish Uniswap v2 and v3 averaging methods and evaluate the trade-off between smoothing and delayed response.",
  "aliases": [
    "TWAP",
    "time-weighted average price"
  ],
  "dates": {
    "published": "2026-10-02",
    "modified": "2026-10-02",
    "verified": "2026-10-02T18:15:18.493Z",
    "dataAsOf": "2026-10-02"
  },
  "authorship": {
    "publisher": "Degrees of Satoshi editorial project",
    "process": "AI-assisted research and drafting with a separate automated source-verification pass; no external expert or named human review is implied."
  },
  "quickAnswer": {
    "text": "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.",
    "claimId": "twap-oracles-quick-answer",
    "sourceIds": [
      "uniswap-v2",
      "uniswap-v3"
    ]
  },
  "keyFacts": [
    {
      "label": "V2 example",
      "value": "Uniswap v2 accumulates prices to support arithmetic time-weighted averages.",
      "sourceIds": [
        "uniswap-v2"
      ],
      "id": "v2-example",
      "claimId": "twap-oracles-fact-v2-example"
    },
    {
      "label": "V3 example",
      "value": "Uniswap v3 accumulates ticks to support geometric mean prices.",
      "sourceIds": [
        "uniswap-v3"
      ],
      "id": "v3-example",
      "claimId": "twap-oracles-fact-v3-example"
    },
    {
      "label": "Window",
      "value": "The selected interval changes responsiveness and the exposure being measured.",
      "sourceIds": [
        "uniswap-v2",
        "uniswap-v3"
      ],
      "id": "window",
      "claimId": "twap-oracles-fact-window"
    }
  ],
  "prerequisites": [
    "blockchain-oracles"
  ],
  "sections": [
    {
      "id": "arithmetic",
      "heading": "Weight by time rather than number of trades",
      "sourceIds": [
        "uniswap-v2"
      ],
      "paragraphs": [
        "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."
      ]
    },
    {
      "id": "cumulative",
      "heading": "Subtract two observations and divide by elapsed time",
      "sourceIds": [
        "uniswap-v2"
      ],
      "paragraphs": [
        "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."
      ]
    },
    {
      "id": "limits",
      "heading": "Smoothing trades immediacy for a longer measurement",
      "sourceIds": [
        "uniswap-v2",
        "uniswap-v3"
      ],
      "paragraphs": [
        "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."
      ]
    }
  ],
  "faq": [
    {
      "question": "Are all TWAP values calculated the same way?",
      "answer": "No. Arithmetic and geometric approaches differ, as do observation windows and sources. Uniswap v2 and v3 illustrate why the exact method must be identified.",
      "sourceIds": [
        "uniswap-v2",
        "uniswap-v3"
      ]
    }
  ],
  "claims": [
    {
      "id": "twap-oracles-quick-answer",
      "articleSlug": "twap-oracles",
      "statement": "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.",
      "sourceIds": [
        "source-9d6f5c70415da83e",
        "source-a0860b156550d3eb"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-9d6f5c70415da83e",
          "locator": "Price oracle; Liquidity; Fees"
        },
        {
          "sourceId": "source-a0860b156550d3eb",
          "locator": "Concentrated Liquidity; Oracle"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Reopened both white papers and visually inspected v2 page3 cumulative-price equations and v3 pages3–4 oracle discussion. V2 arithmetic versus v3 tick/log-price geometric averaging is correctly distinguished.",
          "Recomputed (100*30+120*30)/60=110. Read observation-history requirements and longer-window latency/manipulation trade-off; article does not claim universal manipulation resistance."
        ]
      }
    },
    {
      "id": "twap-oracles-fact-v2-example",
      "articleSlug": "twap-oracles",
      "statement": "V2 example: Uniswap v2 accumulates prices to support arithmetic time-weighted averages.",
      "sourceIds": [
        "source-9d6f5c70415da83e"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-9d6f5c70415da83e",
          "locator": "Price oracle; Liquidity; Fees"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Reopened both white papers and visually inspected v2 page3 cumulative-price equations and v3 pages3–4 oracle discussion. V2 arithmetic versus v3 tick/log-price geometric averaging is correctly distinguished.",
          "Recomputed (100*30+120*30)/60=110. Read observation-history requirements and longer-window latency/manipulation trade-off; article does not claim universal manipulation resistance."
        ]
      }
    },
    {
      "id": "twap-oracles-fact-v3-example",
      "articleSlug": "twap-oracles",
      "statement": "V3 example: Uniswap v3 accumulates ticks to support geometric mean prices.",
      "sourceIds": [
        "source-a0860b156550d3eb"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-a0860b156550d3eb",
          "locator": "Concentrated Liquidity; Oracle"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Reopened both white papers and visually inspected v2 page3 cumulative-price equations and v3 pages3–4 oracle discussion. V2 arithmetic versus v3 tick/log-price geometric averaging is correctly distinguished.",
          "Recomputed (100*30+120*30)/60=110. Read observation-history requirements and longer-window latency/manipulation trade-off; article does not claim universal manipulation resistance."
        ]
      }
    },
    {
      "id": "twap-oracles-fact-window",
      "articleSlug": "twap-oracles",
      "statement": "Window: The selected interval changes responsiveness and the exposure being measured.",
      "sourceIds": [
        "source-9d6f5c70415da83e",
        "source-a0860b156550d3eb"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-9d6f5c70415da83e",
          "locator": "Price oracle; Liquidity; Fees"
        },
        {
          "sourceId": "source-a0860b156550d3eb",
          "locator": "Concentrated Liquidity; Oracle"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Reopened both white papers and visually inspected v2 page3 cumulative-price equations and v3 pages3–4 oracle discussion. V2 arithmetic versus v3 tick/log-price geometric averaging is correctly distinguished.",
          "Recomputed (100*30+120*30)/60=110. Read observation-history requirements and longer-window latency/manipulation trade-off; article does not claim universal manipulation resistance."
        ]
      }
    }
  ],
  "sources": [
    {
      "id": "uniswap-v2",
      "label": "Uniswap v2 whitepaper",
      "publisher": "Uniswap",
      "url": "https://app.uniswap.org/whitepaper.pdf",
      "locator": "Price oracle; Liquidity; Fees",
      "note": "Full-range constant-product inventory and cumulative-price oracle design.",
      "version": "Uniswap v2 whitepaper, March 2020",
      "checkedAt": "2026-10-02T17:03:45.008Z",
      "contentSha256": "32f8efd517767d8effb908e322df5ed1fe746ad0a3e642d49596cf2de1a6d21d",
      "recordId": "source-9d6f5c70415da83e"
    },
    {
      "id": "uniswap-v3",
      "label": "Uniswap v3 whitepaper",
      "publisher": "Uniswap",
      "url": "https://app.uniswap.org/whitepaper-v3.pdf",
      "locator": "Concentrated Liquidity; Oracle",
      "note": "Range-based positions and oracle time accumulation.",
      "version": "Uniswap v3 whitepaper, March 2021",
      "checkedAt": "2026-10-02T17:03:45.213Z",
      "contentSha256": "1be05d1134f677dfbce9afa7392a2c200c000f3db74fb8d228e3636a2b624494",
      "recordId": "source-a0860b156550d3eb"
    }
  ],
  "related": {
    "articles": [
      "oracle-heartbeat-deviation",
      "constant-product-pools",
      "concentrated-liquidity"
    ],
    "dossiers": [],
    "wallets": []
  },
  "revisionHistory": [
    {
      "date": "2026-10-02",
      "kind": "published",
      "summary": "First publication after primary-source research and independent automated verification."
    }
  ],
  "citation": "Degrees of Satoshi editorial project. “TWAP oracles: averaging prices over time.” Published 2026-10-02; updated 2026-10-02. https://degreesofsatoshi.com/encyclopedia/twap-oracles/"
}
