Historical volatility measures how much past returns varied over a chosen window. Implied volatility is the model volatility that reproduces an observed option price. Historical volatility depends on the return sample and annualisation convention. Implied volatility depends on the option’s strike, maturity, quote and pricing inputs.
Compute the historical estimate and invert the option quote
For daily adjusted prices , calculate log returns . With trading days per year, a sample estimate is
The square-root annualisation is a convention motivated by additive variance under uncorrelated returns. It is a standard way to quote the daily estimate even if your subsequent forecasting model allows time-varying volatility.
For a call quote , solve . Black–Scholes vega is positive for positive , giving a unique finite positive solution when the call lies strictly between its zero-volatility value and upper price bound. A bracketed root finder works well if you verify the price and inputs first.
Suppose the last 21 daily log returns have a sample standard deviation of . Then historical volatility is about annualised. Now take a 30-calendar-day, at-the-money European call on a non-dividend-paying stock, with zero rates and a premium of . Its implied volatility is about . If earnings fall within those 30 days, the comparison gives you a reason to check the scheduled event and compare nearby expirations. Also inspect bid and ask implied volatility. A wide market can make the apparent gap quite sensitive to the quote you choose.
For comparison on the option's horizon, convert an annual volatility to a horizon standard deviation using under the constant-variance convention. If comparing realized variance with an option-based expectation, line up the actual dates and square the standard deviations before making a variance comparison. A trailing month of returns describes a period that has ended. A one-month option refers to the period ahead, which may include an earnings release or another event absent from the trailing window. Matching horizons makes the numbers comparable without turning their difference into a forecast error.
When solving for implied volatility, first check that the option quote lies within its no-arbitrage price bounds under the specified inputs. Away from degenerate cases, the Black–Scholes price increases with volatility, which makes the inversion one-dimensional. Bid and ask prices can imply different volatilities. In a wide market it is more honest to report the corresponding interval than to claim that the midpoint volatility is known precisely. Match the option's maturity, strike and dividend assumptions before using a difference between historical and implied numbers as a research signal.
Compute a historical estimate and solve for implied volatility
from math import sqrt
from scipy.optimize import brentq
from scipy.stats import norm
maturity = 30 / 365
def at_money_call(vol):
d1 = 0.5 * vol * sqrt(maturity)
return 100 * (2 * norm.cdf(d1) - 1)
historical_vol = 0.01 * sqrt(252)
implied_vol = brentq(lambda vol: at_money_call(vol) - 2.75, 1e-8, 3)
print(historical_vol, implied_vol)The volatility surface tool shows why it matters which strike and expiry you take the implied volatility from.