TWAP
Time Weighted Average Price
While it may remind you of a popular song featuring Cardi B, Time-Weighted Average Price (TWAP) is actually a mechanism used to calculate the average price of a stablecoin over a specific period. This method helps to reduce the impact of short-term price volatility by taking into account the price of the stablecoin at different points in time, and assigning each of these prices a weight corresponding to the amount of time during which it prevailed.
Accurate and reliable price information is crucial for the Nebula Cash Protocol's stability mechanisms. The protocol employs a combination of Time-Weighted Average Price (TWAP) and market price data to determine the NUSD price. TWAP is less susceptible to sudden price manipulations, while market price data provides real-time information on current market conditions.
To calculate the TWAP, we first capture the price of NUSD at regular intervals, every 5-15 minutes, then multiply each price, sum up these weighted prices, and then divide by the total time in the epoch; 6 hours.
TWAP = (Σ (Price * Time Period)) / Σ Time Period
The result is a time-weighted average price that gives more importance to the prices that were sustained over a longer duration. This approach can provide a more accurate reflection of a stablecoin's price behavior over a particular period and mitigate the impact of momentary price spikes or dips.
An oracle will average the price of four pairs from our Dex to discover the TWAP, and use that price to determine the current phase of the epoch.
Pairs:
NUSD/USDT
NUSD/USDC
NUSD/BNB
NUSD/ETH
Last updated