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

  • Multisig Recovery

    Multisig Recovery: Getting Back Lost Access Multisig recovery helps regain access to multi-signature wallets when some keys are lost or compromised. It’s like having spare keys for your house, but with cryptographic mathematics. Multisig recovery refers to mechanisms that restore access to multi-signature wallets when the required number of signatures is no longer available due…

  • Multichain Router

    Multichain Router: Cross-Chain Navigation Multichain routers find optimal paths for moving assets between different blockchain networks. They’re like GPS for cross-chain transactions, finding the cheapest and fastest routes. A multichain router is a protocol that automatically finds the best path for transferring assets between different blockchain networks. It compares routes across multiple bridges and chains…

  • Capitulation

    Capitulation: Market Surrender and Mass SellingCapitulation occurs when investors give up hope and sell their holdings en masse, often marking market bottoms. It's like throwing in the towel when everything seems hopeless.Capitulation refers to the point where investors abandon hope and sell their cryptocurrency holdings in large volumes, typically occurring near market bottoms after prolonged…

  • FUD (Fear, Uncertainty, Doubt)

    FUD: Fear, Uncertainty, and Doubt FUD is FOMO’s evil twin. While FOMO makes you buy at peaks, FUD makes you sell at bottoms. Understanding FUD helps you think clearly when markets panic. FUD stands for Fear, Uncertainty, and Doubt – negative sentiment spread to influence crypto prices downward. Sometimes it’s legitimate concerns, often it’s manufactured…

  • Yield Optimization

    Yield Optimization: Maximizing Investment ReturnsYield optimization involves strategically managing cryptocurrency investments to maximize returns through automated rebalancing and strategy switching. It's like having a financial advisor that works 24/7 to find the best returns.Yield optimization refers to automated strategies and protocols that maximize returns on cryptocurrency investments by continuously monitoring and switching between different yield-generating…

  • Liquidity Bootstrapping

    Liquidity Bootstrapping: Fair Token Launch Mechanism Liquidity bootstrapping uses gradually declining prices to enable fair token distribution while building trading liquidity. It’s like having a reverse auction that creates a fair market price. Liquidity bootstrapping is a token launch mechanism that starts with high prices that gradually decrease over time, allowing market forces to discover…