The simulator provides key volatility metrics related to the underlying for every simulation run. These volatility metrics are made accessible to the user via the following variables:
All the calculated metrics are cross-checked and validated against key trading platforms (Interactive Brokers, TD Ameritrade and TastyTrade) respective values. The accuracy of our calculation matches over 95% of the time those trading platforms.
Historical Volatility is calculated by looking back 30 calendar days and taking the log returns of the close prices on every given day. Using these prices, the standard deviation (square root of variance) is calculated and multiplied by the square root of trading days (252):
stdDev = Sqrt(logReturns.Sum(r => Pow(avg - r, 2)) / (logReturns.Count)); underlying_hv = Sqrt(252) *stdDev;
Please note, that as historical volatility is not updated intraday as it's using close prices.
The overall implied volatility for the underlying is calculated using the Options Contracts:
- Option Types: Put Only
- Expirations: Closest to 30 days out at any given time
- Strikes: closest to underlying (ATM)
The calculation filters for bad data (outliers) and liquidity to have a realistic measure of implied volatility.
Additionally, IV Rank and Percentile are calculated by looking back 1 calendar year as follows:
Find the period's
low overall implied volatility. Count the number of
total days and days where overall implied volatility is
under (below) the current.
underlying_iv_rank = ((price.ImpliedVolatility - low) / (high - low)) * 100; underlying_iv_pct = (under / total) * 100;
All implied volatility metrics are updated intra-day.
1) MesoSim's Implied Volatility is not sourced from Deribit's DVOL, but calculated internally.
2) In case of Historical Volatility calculation, the End of Day is considered to be 00:00 UTC.