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 Allocation

    Token Allocation: Distributing Digital AssetsToken allocation determines how cryptocurrency tokens are distributed among different stakeholders like teams, investors, and communities. It's the blueprint for who gets what in crypto projects.Token allocation refers to the distribution plan for cryptocurrency tokens among various stakeholder groups including development teams, early investors, community members, and ecosystem development funds. This distribution…

  • Leverage

    Leverage: Borrowing Money to Amplify TradesLeverage lets you control larger positions than your actual capital by borrowing funds from exchanges or platforms. It's like using a lever to lift heavy objects – small movements create big effects.Leverage in cryptocurrency trading allows borrowing funds to increase position sizes beyond available capital, amplifying both potential profits and…

  • Transaction Approval

    Transaction Approval: Authorizing Blockchain ActionsTransaction approval is the process of authorizing blockchain operations through wallet signatures or smart contract permissions. It's like signing checks, but with permanent consequences.Transaction approval involves granting permission for blockchain operations through cryptographic signatures, smart contract interactions, or delegation mechanisms. These approvals authorize spending, contract execution, or account access.How Transaction Approval WorksSignature…

  • AMM

    AMM: Automated Market MakingAutomated Market Makers use mathematical formulas to price assets and facilitate trading without traditional order books. They're like vending machines for cryptocurrency trading.An Automated Market Maker (AMM) is a decentralized exchange mechanism that uses mathematical algorithms to price assets and facilitate trading through liquidity pools instead of order books. AMMs enable constant liquidity…

  • Lightning Network

    Lightning Network: Bitcoin Payment ScalingLightning Network enables instant, low-cost Bitcoin payments through off-chain payment channels. It's like having express lanes on a highway that bypass traffic congestion while still connecting to the same destination.Lightning Network is a Layer 2 scaling solution that enables fast, cheap Bitcoin transactions through a network of payment channels that settle…

  • Soulbound Token (SBT)

    Soulbound Token (SBT): Non-Transferable Achievements Soulbound tokens are NFTs that cannot be transferred or sold once received. They represent achievements, credentials, or identity elements that should remain permanently attached to specific individuals. A Soulbound Token (SBT) is a non-fungible token that is permanently bound to a specific wallet address and cannot be transferred or sold….