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

  • Utility Token

    Utility Token: Digital Tools with PurposeUtility tokens provide access to specific products, services, or features within blockchain ecosystems. They're like arcade tokens that let you play specific games or use certain services.A utility token is a cryptocurrency designed to provide access to a product, service, or feature within a specific blockchain ecosystem rather than serving…

  • Wei

    Wei: Ethereum's Smallest UnitWei is the smallest denomination of Ethereum, similar to how cents are the smallest unit of dollars. It's like measuring distances in millimeters when you need precision, even though we usually think in meters or kilometers.Wei represents the smallest possible unit of Ethereum (ETH), with one ETH equal to 1,000,000,000,000,000,000 (10^18) wei. This…

  • Blockchain Trilemma

    Blockchain Trilemma: The Impossible TrinityThe blockchain trilemma describes the challenge of simultaneously achieving decentralization, security, and scalability in blockchain networks. It's like trying to be fast, cheap, and high-quality all at the same time.The blockchain trilemma refers to the fundamental trade-off between three key properties: decentralization, security, and scalability, where optimizing for two typically requires…

  • Base Layer

    Base Layer: Blockchain FoundationThe base layer is the underlying blockchain protocol that provides fundamental functionality like consensus, security, and transaction processing. It's the foundation that everything else builds upon.Base layer refers to the core blockchain protocol that handles basic functions like transaction validation, consensus, and security without relying on external systems. This is Layer 1 infrastructure…

  • Stable Yield

    Stable Yield: Predictable DeFi Returns Stable yield refers to DeFi strategies that provide consistent returns with lower volatility than traditional yield farming. It’s like finding the boring but reliable investment in a casino full of slot machines. Stable yield strategies focus on generating consistent returns from DeFi protocols with lower risk and volatility than high-APY…

  • FOMO (Fear of Missing Out)

    FOMO: The Psychology That Drives Crypto Markets FOMO (Fear of Missing Out) is responsible for more bad crypto decisions than any technical analysis could prevent. It’s the emotional trap that turns rational people into panic buyers. FOMO is the anxiety that others are experiencing rewarding experiences from which one is absent. In crypto, it manifests…