How Is a “Time-Weighted Average Price” (TWAP) Used in a DeFi Oracle System?
A TWAP is used to calculate the average price of an asset over a specific time interval, where each price point is weighted by the amount of time it was active. DeFi Oracles use TWAPs to provide a price feed that is resistant to flash loan attacks and momentary price spikes.
By smoothing out volatility, the TWAP ensures that smart contract executions, like liquidations or settlements, are based on a fairer, more representative market price.