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

  • Dusting Attack

    Dusting Attack: Tracking Through Tiny Transactions Dusting attacks send tiny amounts of cryptocurrency to addresses to track user behavior and deanonymize transactions. It’s like sprinkling digital breadcrumbs to follow where people go. A dusting attack sends small amounts of cryptocurrency (dust) to many addresses to track users’ transaction patterns and potentially identify wallet owners. Attackers…

  • Transaction

    Transaction: Moving Value on the BlockchainA cryptocurrency transaction transfers value from one address to another on a blockchain network. It's like writing a check, but with mathematical guarantees instead of trust.A transaction is a digitally signed transfer of cryptocurrency from one wallet address to another, recorded permanently on the blockchain. Every transaction includes sender information, recipient…

  • Mining Pool

    Mining Pool: Collaborative Block Mining Mining pools combine computational power from multiple miners to increase chances of finding blocks and earning rewards. It’s like joining a lottery syndicate to improve your odds. A mining pool is a collaborative group of cryptocurrency miners who combine their computational resources to increase their chances of successfully mining blocks…

  • Capital Efficiency

    Capital Efficiency: Maximizing Resource UtilizationCapital efficiency measures how effectively investments generate returns relative to the amount of capital deployed. It's like getting the most miles per gallon from your investment fuel.Capital efficiency refers to maximizing returns or utility from invested capital through optimal allocation, leverage, or innovative strategies that reduce required capital while maintaining or…

  • Gas Token

    Gas Token: Optimizing Transaction Costs Gas tokens store cheap gas for later use when network fees are high. It’s like buying gasoline when prices are low and using it when prices spike. A gas token is a cryptocurrency designed to optimize transaction costs by storing cheap gas during low-demand periods for use when fees are…

  • Token Supply

    Token Supply: Digital Asset QuantityToken supply refers to the total number of cryptocurrency tokens that exist, will exist, or are available for trading. It's a fundamental factor in determining token economics and value.Token supply encompasses the total quantity of cryptocurrency tokens in existence, including circulating supply available for trading and total supply that will ever…