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

  • Token Lockup

    Token Lockup: Preventing Early Selling Token lockups prevent allocated tokens from being sold or transferred for specific time periods. It’s like putting your poker winnings in a time-locked safe to prevent impulse spending. Token lockup is a mechanism that prevents token holders from selling, transferring, or accessing their tokens until predetermined conditions are met. Lockups…

  • Whale

    Whale: The Big Players Who Move Markets In crypto, whales are individuals or entities holding massive amounts of cryptocurrency. When whales move, markets tremble. A whale is someone who holds enough cryptocurrency to significantly influence market prices through their trading decisions. For Bitcoin, this typically means holding 1,000+ BTC (worth $30+ million at current prices)….

  • Smart Order Routing

    Smart Order Routing: Optimal Trade Execution Smart order routing automatically finds the best prices across multiple exchanges and liquidity sources for each trade. It’s like having a shopping bot that checks every store for the best deal. Smart order routing is an algorithmic system that automatically splits and routes orders across multiple trading venues to…

  • Protocol Revenue

    Protocol Revenue: Earning from Network ActivityProtocol revenue refers to income generated by blockchain protocols through transaction fees, service charges, or other value capture mechanisms. It's like toll roads that collect fees from everyone who uses the infrastructure.Protocol revenue encompasses all income streams generated by blockchain protocols including transaction fees, service charges, governance fees, and other…

  • Rollup-as-a-Service (RaaS)

    Rollup-as-a-Service (RaaS): Custom Blockchain Infrastructure RaaS platforms provide infrastructure for deploying custom rollups without building all the technical components from scratch. It’s like having a franchise model for blockchain networks. Rollup-as-a-Service (RaaS) provides infrastructure and tooling for organizations to deploy their own application-specific rollups without deep blockchain development expertise. These platforms handle the technical complexity…

  • Front Running

    Front Running: Trading Ahead of OthersFront running involves placing trades ahead of known pending transactions to profit from anticipated price movements. It's like cutting in line when you know someone behind you will move the market.Front running is the practice of placing trades based on advance knowledge of pending transactions that will likely affect asset…