Free lesson · Volatility
Realized variance starts with squared returns
Open interactive lessonPractice calculationsExplore labs
Start with the idea
A volatility estimate summarizes a path’s movement; the sampling rule determines which movement is visible.
Symbols, units & horizon
- r_j: intraday log-return fraction in interval j of one complete trading day
- n: count of sampled intervals
- RV: that day’s uncentered squared log-return sum
- D: assumed comparable trading days per year
- σ_ann: annualized volatility fraction per square-root year
When and why to use this
Create a reproducible daily risk target and compare sampling choices.
A volatility estimate summarizes a path’s movement; the sampling rule determines which movement is visible.
For intraday log returns, summing squares gives a realized-variance proxy for the observed window. It differs from demeaned sample variance. At coarse intervals drift matters; at very fine intervals bid/ask bounce and price discreteness distort the estimator.
An annualized daily estimate multiplies daily variance by a stated number of comparable trading days, then takes the square root. Equities and continuously traded digital assets need explicit calendar choices and overnight treatment.
Realized variance starts with squared returns
- Compute non-overlapping intraday log returns over the declared day.
- Square and sum them without subtracting a daily mean for this estimator.
- Multiply by D before taking the square root; this annualization is a scaling assumption.
Two intraday returns .01 and −.02 give RV=.0001+.0004=.0005. With D=252, annualized volatility is sqrt(.126)≈.354965, or 35.50%.
Apply it in a strategy
- Freeze inputs at the stated decision time and record their units.
- Create a reproducible daily risk target and compare sampling choices.
- Recompute the example, then change the material assumption and explain the difference.
Research deliverable
Realized variance starts with squared returns: produce the worked calculation, a timestamped input record and a written decision addressing this limitation: Market microstructure noise, omitted overnight returns and nonrepresentative days can invalidate the interpretation.
These are synthetic mechanics examples, not historical performance or paper replications. Module evidence and research boundaries record the 12 September 2026 review.
Research sources, review dates and limitations
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
# Python 3.10+; standard library and NumPy only.
# Synthetic teaching inputs; conventions and units are defined in the notation above.
import numpy as np
def realized_volatility(log_returns,days_per_year=252):
r=np.asarray(log_returns,float)
if r.ndim!=1 or len(r)==0 or not np.isfinite(r).all() or days_per_year<=0: raise ValueError('Finite returns and positive day count required')
variance=float(r@r)
return variance,float(np.sqrt(days_per_year*variance))
assert abs(realized_volatility([.01,-.02])[0]-.0005)<1e-12
print(realized_volatility([.01,-.02]))Continue learning
Volatility: Measurement, Surfaces & Variance Risk — all lessons- Realized variance starts with squared returns
- EWMA as a causal variance baseline
- A multi-horizon realized-variance forecast
- Implied volatility is a model inversion
- Term structure through total and forward variance
- Strike convexity and a butterfly consistency check
- Vega requires a volatility-unit convention
- Variance exposure and the difference from arbitrage
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations