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

  • Node

    Node: The Network’s Backbone Nodes are individual computers that maintain copies of the blockchain and enforce network rules. They’re the distributed infrastructure that makes cryptocurrency possible. A node is a computer that participates in a blockchain network by maintaining a copy of the distributed ledger and relaying transactions. Nodes validate transactions, store blockchain history, and…

  • Gwei

    Gwei: Ethereum’s Gas Price Unit Gwei is the denomination used for Ethereum gas prices. Understanding gwei helps you avoid overpaying for transactions when the network gets congested. Gwei (gigawei) is a unit of Ethereum’s native currency equal to one billionth of an ETH (10^-9 ETH). It’s the standard unit for expressing gas prices, making it…

  • Yield Engineering

    Yield Engineering: Manufacturing ReturnsYield engineering creates artificial income streams through complex financial strategies and derivative products. It's like building a return-generating machine from financial spare parts.Yield engineering refers to creating yield opportunities through structured products, derivatives, and complex strategies rather than from underlying asset productivity. These engineered returns often involve multiple moving parts and sophisticated risk…

  • Sustainable Yield

    Sustainable Yield: Long-Term Return GenerationSustainable yield refers to returns that can be maintained long-term without depleting the underlying value source. It's like earning interest that doesn't eventually destroy the principal.Sustainable yield represents returns generated from real economic activity and value creation rather than unsustainable token emissions or Ponzi-like mechanisms. These yields can theoretically continue indefinitely.How Sustainable…

  • Security

    Security: Protecting Digital Assets and InformationSecurity in cryptocurrency encompasses all measures taken to protect digital assets, private keys, and personal information from theft or compromise. It's the foundation that makes cryptocurrency ownership safe and reliable.Security refers to the comprehensive protection of cryptocurrency assets, private keys, wallet access, and personal information through technical measures and careful…

  • Execution Layer

    Execution Layer: Transaction Processing EngineThe execution layer handles transaction processing and smart contract execution within blockchain architectures. It's like the engine that actually does the work in a modular blockchain system.The execution layer is responsible for processing transactions, executing smart contracts, and managing state changes within blockchain networks. In modular architectures, this layer can be optimized…