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

  • Cross-Chain Bridge

    Cross-Chain Bridge: Connecting Blockchain Islands Cross-chain bridges move assets between different blockchains, connecting isolated cryptocurrency ecosystems. They’re the highways between blockchain cities, but sometimes the bridges collapse. A cross-chain bridge is a protocol that enables the transfer of tokens, data, or smart contract calls between different blockchain networks. Bridges solve blockchain interoperability by creating connections…

  • Slippage

    Slippage: The Cost of Market Impact Slippage is the difference between expected and actual trade prices. It’s the tax you pay for moving markets when your trade is large relative to available liquidity. Slippage occurs when the execution price of a trade differs from the expected price due to market movement or insufficient liquidity. Large…

  • Anti-Sybil Mechanism

    Anti-Sybil Mechanism: Preventing Fake Identity Attacks Anti-Sybil mechanisms prevent individuals from creating multiple fake identities to gain unfair advantages in voting, airdrops, or governance systems. They’re like requiring photo ID to prevent ballot stuffing. Anti-Sybil mechanisms are systems designed to prevent or detect when single entities create multiple fake identities to manipulate voting, governance, or…

  • Spam

    Spam: Unwanted Blockchain TransactionsSpam in cryptocurrency refers to unwanted or low-value transactions that clog networks and waste resources. It's like junk mail but for blockchain networks.Spam consists of unwanted transactions, messages, or data that consume network resources without providing legitimate value. These activities can degrade network performance and increase costs for legitimate users.How Crypto Spam WorksNetwork…

  • Circulating Supply

    Circulating Supply: Tokens Available for TradingCirculating supply represents the number of cryptocurrency tokens currently available for public trading and use. It's like counting how much money is actually in circulation versus locked away.Circulating supply refers to the number of cryptocurrency tokens that are publicly available and actively trading in the market. This excludes tokens that are…

  • Recovery

    Recovery: Restoring Access to Crypto AssetsRecovery refers to methods for regaining access to cryptocurrency wallets and accounts when primary access methods are lost or compromised. It's like having spare keys for your digital vault.Recovery encompasses various mechanisms for restoring access to cryptocurrency wallets, accounts, or assets when primary authentication methods like passwords or devices are…