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

  • On-Chain Reputation

    On-Chain Reputation: Verifiable Digital Standing On-chain reputation tracks user behavior and achievements through permanent blockchain records. It’s like having a credit score built from your entire crypto transaction history. On-chain reputation systems create verifiable records of user behavior, achievements, and interactions that persist across applications and can’t be faked or manipulated. These systems enable trust…

  • Cryptographic Proof

    Cryptographic Proof: Mathematical VerificationCryptographic proof provides mathematical certainty about the validity of information without revealing sensitive details. It's like proving you know a secret without actually telling anyone what the secret is.Cryptographic proof refers to mathematical techniques that verify the authenticity, integrity, or validity of information using cryptographic methods. These proofs enable trust and verification without…

  • HODL

    HODL: The Art of Doing Nothing HODL started as a typo but became crypto’s most important investment strategy. Sometimes the best move is not moving at all. HODL means holding cryptocurrency long-term regardless of short-term price volatility, derived from a misspelled “hold” in a 2013 Bitcoin forum post. It represents the strategy of buying and…

  • Dynamic NFTs (dNFTs)

    Dynamic NFTs (dNFTs): Evolving Digital Assets Dynamic NFTs can change their metadata, appearance, or properties based on external data or on-chain events. They’re like digital collectibles that grow and evolve over time. Dynamic NFTs (dNFTs) are non-fungible tokens that can modify their metadata, attributes, or visual appearance in response to external data feeds, user actions,…

  • UTXO

    UTXO: Unspent Transaction OutputsUTXOs are like digital coins in your wallet that you haven't spent yet. Bitcoin tracks every unspent "coin" to prevent double-spending and maintain accurate balances.UTXO stands for Unspent Transaction Output – pieces of bitcoin that remain after a transaction and can be used as inputs for future transactions. Think of them as individual…

  • DEX Aggregator

    DEX Aggregator: Optimal Trading Route FinderDEX aggregators find the best prices across multiple decentralized exchanges for cryptocurrency trades. They're like price comparison websites that automatically execute trades at the best available rates.A DEX aggregator is a service that compares prices and liquidity across multiple decentralized exchanges to find optimal trading routes for cryptocurrency swaps. These platforms…