Lesson 11 of 15
Volatility Clustering
Volatility Clustering
A well-known stylized fact in financial time series: large price moves tend to cluster together. Periods of high volatility are followed by more high volatility.
Log Returns
For a price series prices, the log return at time t is:
r[t] = ln(prices[t+1] / prices[t])
Squared Returns
Squared returns are a proxy for volatility:
r[t]²
High squared return = high volatility at that point.
Volatility Cluster Ratio
The fraction of returns with squared return exceeding a threshold:
cluster_ratio = count(r[t]² > threshold) / n
Task
Implement:
squared_returns(prices)→ list of squared log returnsvolatility_cluster_ratio(prices, threshold)→ fraction of high-volatility observations
Python runtime loading...
Loading...
Click "Run" to execute your code.