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

  • Market Cap

    Market Cap: How to Value Crypto Projects Market cap tells you how much the entire crypto market values a project. It’s the most important number for comparing different cryptocurrencies. Market capitalization is the total value of all coins in circulation, calculated by multiplying the current price by the circulating supply. It shows the relative size…

  • Modular Blockchain

    Modular Blockchain: Specialized Building Blocks Modular blockchains separate core functions like consensus, execution, and data availability into specialized layers. It’s like having a restaurant where different teams handle cooking, serving, and cleaning instead of one person doing everything. Modular blockchain architecture separates blockchain functions into distinct layers that can be optimized independently. This allows specialization…

  • Smart Contract Analysis

    Smart Contract Analysis: Code Security EvaluationSmart contract analysis involves examining blockchain code for vulnerabilities, bugs, and security issues before deployment. It's like having a building inspector check the foundation before construction begins.Smart contract analysis refers to the systematic examination of smart contract code to identify security vulnerabilities, logic errors, and potential attack vectors. This process helps…

  • Chain Abstraction

    Chain Abstraction: Invisible Multi-Chain Experience Chain abstraction hides blockchain complexity from users, making multi-chain interactions feel like using a single network. It’s like having universal currency that works everywhere without exchange rates. Chain abstraction creates user experiences where interactions with multiple blockchains happen seamlessly without users needing to understand or manage different networks, tokens, or…

  • Tokenomics

    Tokenomics: The Economics of Digital Assets Tokenomics determines how cryptocurrencies create, distribute, and maintain value over time. It’s the difference between digital money and digital monopoly money. Tokenomics refers to the economic design and mechanics of a cryptocurrency token, including supply schedules, distribution methods, utility functions, and incentive structures. Good tokenomics align stakeholder interests while…

  • Token Emissions

    Token Emissions: New Cryptocurrency CreationToken emissions refer to the creation and distribution of new cryptocurrency tokens over time according to predetermined schedules. It's like a factory that produces new money at controlled rates rather than printing it all at once.Token emissions describe the systematic creation and release of new cryptocurrency tokens into circulation according to…