Realized volatility
Measuring path dispersion without confusing an estimator for an observable truth
01Compute close-to-close and range-based realized-volatility estimators with explicit units.
02Derive annualization from return variance rather than memorizing a square-root rule.
03Diagnose window, sampling, jump and microstructure effects.
04Interpret a rolling estimate as a backward-looking state variable, not a forecast.
Build the state before the equation.
Realized volatility is an estimate extracted from a finite price path. The sampling clock, return definition, window and treatment of jumps are part of the number—not implementation details.
Prices are observed; volatility is estimated from returns.
Variance aggregates across independent increments; volatility inherits square-root time scaling only under stated assumptions.
Range estimators use intraday extremes efficiently but impose stronger path assumptions.
The product exists before the model.
Risk limits, variance-swap marks, volatility targeting and model validation all need an ex-post measure of dispersion that can be reproduced from a fixed dataset.
cash equities and indices
futures
variance swaps
volatility-controlled portfolios
This lesson reports annualized decimal volatility from log returns and an ACT/365-like clock. A displayed 20% means 0.20 in calculations.
Notation, units and exact claims.
r_t = ln(S_t/S_{t-1}): log returnn: observations in the windowA: observations per yearλ: EWMA decayClose-to-close estimator
Annualized sample standard deviation of equally spaced log returns.
Parkinson range estimator
Uses the intraday high-low range and is efficient under a continuous driftless diffusion, but misses overnight jumps.
EWMA variance
A recursive state with geometrically decaying memory; the decay factor determines responsiveness.
Do not jump to the final expression.
From quadratic return variation to an annualized quote
The square-root rule follows from a variance model; it is not a universal unit conversion.
- 01
Define the return clock
Choose close-to-close log returns at a fixed sampling interval and preserve timezone, corporate-action and missing-observation rules.
- 02
Estimate one-period variance
Center the sample when estimating unconditional variance. For a zero-mean high-frequency model, realized variance often uses the uncentered sum.
- 03
Derive time aggregation
If equal-period returns are uncorrelated with common variance, the variance of their sum is the sum of variances.
- 04
Convert variance to volatility
Taking the positive square root produces annualized volatility.
- 05
Choose an estimator for the data
OHLC estimators can reduce sampling noise, while EWMA deliberately weights recent shocks more heavily. Compare estimators rather than silently switching definitions.
A realized-volatility number is auditable only when its return clock, estimator, window, annualization and data cleaning are attached.
Fit, compute, then challenge the assumptions.
Compute several estimators over the same clean path, report their definitions, and examine sensitivity to sampling and window length.
There is no option calibration. Select λ or window length through a documented forecasting or risk objective and validate out of sample.
Backward-looking and regime dependent.
Sensitive to jumps, market closure and microstructure noise.
Square-root scaling can fail under autocorrelation or non-stationarity.
Static fit is not dynamics.
| Question | Black–Scholes | Local volatility | Heston |
|---|---|---|---|
| Volatility state | One constant σ | σ(S,t) deterministic | vₜ stochastic |
| Fits today’s surface | No | Exactly, in ideal theory | Approximately by calibration |
| Forward dynamics | Flat smile | Spot-driven | Variance + correlation driven |
| Primary strength | Transparent baseline | Vanilla-consistent diffusion | Richer smile dynamics |
| Primary failure | No smile | Often unrealistic forward skew | Parameter and calibration instability |
| Compute | Low | Medium: PDE/MC | Medium–high: Fourier/PDE/MC |
| Hedge implication | Greeks at one σ | State-localized vol hedge | Variance and vol-of-vol risk |
Implementation with current QuantLib
Current QuantLib separates market structures, processes, instruments, engines and calibration helpers. Use those abstractions only after the lesson’s conventions, domains and numerical checks are explicit.
API authority: upstream QuantLib reference pinned in the source registry.Theory → implementation → checks.
Auditable realized-volatility estimators
Compute close-to-close, Parkinson and EWMA estimates from a deterministic price path.
from __future__ import annotations import numpy as np def realized_vol(close: np.ndarray, periods: int = 252) -> float: if close.ndim != 1 or close.size < 3 or np.any(close <= 0): raise ValueError("close must contain at least three positive prices") returns = np.diff(np.log(close)) return float(np.std(returns, ddof=1) * np.sqrt(periods)) def parkinson(high: np.ndarray, low: np.ndarray, periods: int = 252) -> float: if high.shape != low.shape or np.any(high < low) or np.any(low <= 0): raise ValueError("invalid high-low path") variance = np.mean(np.log(high / low) ** 2) / (4.0 * np.log(2.0)) return float(np.sqrt(periods * variance)) close = np.array([100.0, 101.2, 99.8, 102.1, 101.4, 103.0])high = close[1:] * 1.008low = close[1:] * 0.992sigma_cc = realized_vol(close)sigma_p = parkinson(high, low)assert np.isfinite([sigma_cc, sigma_p]).all()assert sigma_cc > 0.0 and sigma_p > 0.0print(f"CC {sigma_cc:.2%} | Parkinson {sigma_p:.2%}")Move the state. Challenge the equation.
Estimator and regime lab
Change estimator, window and scenario; inspect the path, rolling estimate and annualization together.
Where the model meets the book.
“The window is a position: it determines which regime you are carrying into the number.”
adjusted OHLC path
sampling clock
window
annualization basis
jump and missing-data policy
There is no option calibration. Select λ or window length through a documented forecasting or risk objective and validate out of sample.
RISKestimator risk
regime lag
jump sensitivity
sampling bias
- freeze path
- clean events
- compute estimators
- compare windows
- flag breaks
Production failure modes
- unadjusted splits
- mixed timezones
- overnight gaps omitted
- percent/decimal mismatch
Map the transmission channel.
Realized volatility as a regime recorder
Macro shocks enter the observed path through jumps, clustered returns and changing correlations; the window controls how long that regime remains visible.
moves prices and correlations
records jumps and clustering
weights and annualizes the path
feeds limits and forecasts
Most failures begin outside the formula.
Calling the estimate observable volatility.
Annualizing without stating the return interval.
Comparing OHLC and close-only estimators as if assumptions were identical.
Treating a rolling window as forward-looking.
Attribution with implementation authority.
Volatility, Monte Carlo and stochastic-volatility lectures
Research map for the mathematical progression and numerical experiments; prose, examples and code are original.
- Source
- Computational Finance Course
- Author
- L. A. Grzelak
- Ref
- main
Current volatility structures, processes, calibration helpers and tests
Implementation reference for production abstractions and validation patterns.
- Source
- QuantLib upstream
- Author
- QuantLib contributors
- Ref
- v1.42.1