Lesson 14 of 15

Realized Volatility

Realized Volatility

Realized volatility is a non-parametric measure of volatility computed directly from observed high-frequency price data. Unlike GARCH, it doesn't assume a parametric model.

Definition

Given a price series, compute the log returns and take the square root of the sum of squared returns:

RV = √(Σ r[t]²)

where r[t] = ln(prices[t+1] / prices[t]).

Annualization

To express realized volatility on an annualized basis, scale by the square root of the number of trading periods per year:

RV_annual = RV × √(252 / n)

where n is the number of return observations and 252 is the typical number of trading days per year.

Task

Implement:

  • realized_vol(prices) → square root of sum of squared log returns
  • annualized_realized_vol(prices) → annualized realized volatility
Python runtime loading...
Loading...
Click "Run" to execute your code.