Submitted by Lambda
DataStorage.sol#L53
The system calculates the volatility over a time period like this:
$\delta(t)=\frac{1}{T} \sum\_{\tau \in\[t-T, t]}(P(\tau)-\bar{P}(\tau))^{2}$
However, while this estimator is consistent (it converges in probability as the number of samples goes to infinity), it is biased and the produced estimates for finite sample sizes will be generally too low. This will result in fees that are lower than they should be (because the volatility is underestimated) and therefore hurt users.
Apply Bessels correction to get an unbiased estimate, i.e.:
$\delta(t)=\frac{1}{T - 1} \sum\_{\tau \in\[t-T, t]}(P(\tau)-\bar{P}(\tau))^{2}$
vladyan18 (QuickSwap & StellaSwap) acknowledged and commented:
