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 Incentives

    Token Incentives: Rewarding Desired BehaviorToken incentives use cryptocurrency rewards to encourage specific behaviors or participation in networks and protocols. They're like loyalty points that actually have real value and utility.Token incentives refer to mechanisms that distribute cryptocurrency tokens to users who perform desired actions or contribute value to networks and protocols. These align user behavior with…

  • Proof of Humanity

    Proof of Humanity: Verifying Human Uniqueness Proof of Humanity creates registries of verified unique humans to prevent Sybil attacks in voting and distribution systems. It’s like having a bouncer who knows everyone isn’t wearing a disguise. Proof of Humanity is a system for creating verifiable registries of unique human beings to prevent individuals from claiming…

  • Ledger

    Ledger: Hardware Wallet Security Leader Ledger is a leading hardware wallet company that provides secure offline storage for cryptocurrency private keys. They’re like the Fort Knox of crypto storage devices. Ledger is a hardware wallet manufacturer that creates secure devices for storing cryptocurrency private keys offline, protecting them from online threats and hacking attempts. These…

  • Full Node

    Full Node: Complete Blockchain ParticipantA full node maintains a complete copy of the blockchain and validates all transactions independently. It's like having the complete library instead of just borrowing books when you need them.A full node is a computer that downloads, stores, and validates the complete blockchain history while participating in network consensus and transaction…

  • Custom Blockchain

    Custom Blockchain: Purpose-Built NetworksA custom blockchain is a network designed for specific use cases rather than general-purpose applications. It's like building a specialized tool for a particular job instead of using a multi-purpose tool.A custom blockchain is a purpose-built blockchain network designed to meet specific requirements for particular applications or use cases. These networks optimize for…

  • Metadata

    Metadata: Data About DataMetadata provides information about other data, such as describing what an NFT represents, when it was created, or what properties it has. It's like the label on a file folder that tells you what's inside.Metadata refers to descriptive information about digital assets, transactions, or other data that provides context, properties, and characteristics…