Skip to main content

What Is a Time-Weighted Average Price (TWAP) Oracle and How Does It Use AMM Price Data?

A TWAP oracle calculates the average price of a token pair over a specific time interval by taking snapshots of the AMM's instantaneous price at regular intervals. This is used by protocols to get a robust and manipulation-resistant price feed.

By averaging the price over time, it mitigates the impact of sudden, large trades (like flash loan attacks) that temporarily spike the instantaneous price, making the price feed safer for lending protocols and derivatives.

What Is a “Time-Weighted Average Price” (TWAP) Oracle and Its Anti-Front-Running Benefit?
How Does a Time-Weighted Average Price (TWAP) Oracle Mitigate Flash Loan Attacks on a Derivatives Contract?
What Is a Volume-Weighted Average Price (VWAP) and How Does It Differ from TWAP?
What Is the Role of Time-Weighted Average Price (TWAP) in DeFi Oracles?