Time-Weighted Average Price (TWAP)

Time-Weighted Average Price (TWAP): Manipulation-Resistant Pricing

TWAP calculates asset prices over extended time periods to resist manipulation and provide more stable price references for protocols. It’s like taking your temperature every hour instead of just once.

Time-Weighted Average Price (TWAP) is a pricing mechanism that calculates the average price of an asset over a specific time period, reducing the impact of short-term price manipulation. TWAP oracles provide more stable price feeds for DeFi protocols.

How TWAP Works

Continuous sampling records asset prices at regular intervals throughout the measurement period rather than relying on single point-in-time prices.

Weighted averaging gives equal weight to each time period, preventing large trades or manipulation attempts from skewing the overall price calculation.

Manipulation resistance makes it expensive and difficult for attackers to influence TWAP prices since they would need to sustain artificial prices over extended periods.

TWAP calculation flow showing price sampling, weighted average, manipulation resistance, and stable price feed

Real-World Examples

  • Uniswap V2/V3 provides TWAP oracles that many protocols use for price feeds
  • MakerDAO uses TWAP prices to prevent flash loan attacks on collateral valuations
  • Compound leverages TWAP pricing to resist oracle manipulation in lending markets

Why Beginners Should Care

Protocol security depends on manipulation-resistant price feeds to prevent flash loan attacks and other exploitation attempts.

Stable liquidations using TWAP prevents users from being liquidated due to temporary price spikes or manipulation.

Lagging prices mean TWAP feeds may not reflect rapid legitimate price movements, potentially affecting trading efficiency.

Related Terms: Oracle, Price Manipulation, Flash Loan Attack, Price Feed

Back to Crypto Glossary

Similar Posts

  • Risk Assessment

    Risk Assessment: Evaluating Investment DangersRisk assessment involves systematically analyzing potential losses and their probabilities before making investment decisions. It's like checking the weather and road conditions before planning a trip.Risk assessment is the process of identifying, analyzing, and evaluating potential risks associated with cryptocurrency investments or activities to make informed decisions. This includes technical, market, regulatory,…

  • Supply

    Supply: Total Token Quantity AvailableSupply refers to the total amount of cryptocurrency tokens available, including those in circulation, locked up, or held by various parties. It's a fundamental economic factor affecting token value.Supply encompasses all cryptocurrency tokens that exist or will exist, including circulating supply available for trading and locked supply held by teams, investors,…

  • Ledger

    Ledger: Hardware Wallet Security Leader Ledger is a leading hardware wallet company that provides secure offline storage for cryptocurrency private keys. They’re like the Fort Knox of crypto storage devices. Ledger is a hardware wallet manufacturer that creates secure devices for storing cryptocurrency private keys offline, protecting them from online threats and hacking attempts. These…

  • Two-Factor Authentication (2FA)

    Two-Factor Authentication (2FA): Your Crypto’s Second Lock 2FA is the minimum security standard for any crypto account worth protecting. If you’re not using it, you’re basically leaving your front door unlocked. Two-factor authentication (2FA) requires two different verification methods to access your account – typically something you know (password) plus something you have (phone or…

  • zk-Rollup

    zk-Rollup: Zero-Knowledge Scaling Solutionzk-Rollups are Layer 2 scaling solutions that bundle hundreds of transactions into single proofs, dramatically reducing costs while maintaining security. They're like packing many letters into one envelope instead of sending each letter separately, but with mathematical proof that all letters are authentic.zk-Rollup refers to a Layer 2 scaling technology that processes…

  • Interoperability

    Interoperability: Blockchain Networks Working TogetherInteroperability enables different blockchain networks to communicate and share information seamlessly. It's like having universal translators for blockchain languages.Interoperability refers to the ability of different blockchain networks to communicate, share data, and interact with each other without requiring centralized intermediaries. This enables cross-chain applications and unified user experiences.How Blockchain Interoperability WorksCross-chain protocols enable…