Calculate the Corsi (2009) Heterogeneous Autoregressive Realized Volatility (HAR-RV) forecast of future daily Realized Variance, per asset.

Volatility clustering happens across multiple, overlapping time horizons at once. HAR-RV captures this cheaply – without the numerical optimization a GARCH-family fit requires (see get_garch) – by regressing future daily Realized Variance on trailing daily, weekly and monthly average Realized Variance components. The daily Realized Variance itself can be constructed in several ways via estimator: the simplest is the squared daily return, while the OHLC range-based estimators (see get_volatility, which exposes the same estimators via its own method parameter) use the daily (pre-period-aggregation) term behind each of those estimators instead, which is more statistically efficient since it uses the daily trading range rather than only the close-to-close move.

The formula is as follows (with the default estimator=”squared_return”, weekly_window=5, monthly_window=22 and horizon=1):

\[\text{RV}_{t} = \text{Return}_{t} ^{2}\] \[\text{RV} ^{w_{t}} = \operatorname{Mean}(\text{RV}_{t-4},\; ...,\; \text{RV}_{t}) \text{and RV} ^{m_{t}} = \operatorname{Mean}(\text{RV}_{t-21},\; ...,\; \text{RV}_{t})\] \[\text{Forecast of RV}_{} (t + 1) = b_{0} + b_{d} \cdot \text{RV}_{t} + b_{w} \cdot \text{RV} ^{w_{t}} + b_{m} \cdot \text{RV} ^{m_{t}}\]

Where b_0, b_d, b_w and b_m are estimated once by ordinary least squares over each asset’s full history, and the forecast of RV_(t+1) is shown at date t. The range-based estimators replace RV_t with the daily Parkinson, Garman-Klass or Rogers-Satchell variance term (see get_volatility).

For more information about the method, see the following paper:

  • Corsi, F. (2009). “A Simple Approximate Long-Memory Model of Realized Volatility.” Journal of Financial Econometrics, 7(2), 174-196.

Also known as: HAR-RV model, Corsi’s HAR model, Heterogeneous Autoregressive model.

HAR-RV Forecast in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_har_rv_forecast as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["SPY", "QQQ"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
    benchmark_ticker=None,
)

toolkit.risk.get_har_rv_forecast(estimator="squared_return").tail(5)

Or, after setting up the Finance Toolkit MCP, ask:

What did the HAR-RV model, built on squared daily returns from 2021 to 2025, forecast for the next-day variance of SPY and QQQ on the last five trading days of 2025?

Which returns:

Date SPY QQQ
2025-12-24 0.0001 0.0001
2025-12-26 0.0001 0.0001
2025-12-29 0.0001 0.0001
2025-12-30 0.0001 0.0001
2025-12-31 0.0001 0.0001

Parameters

get_har_rv_forecast accepts the following parameters.

ParameterTypeDescriptionExample
estimatorstrHow to construct the daily Realized Variance input, one of “squared_return”, “parkinson”, “garman_klass” or “rogers_satchell”. Defaults to “squared_return”."parkinson"
weekly_windowintThe trailing window (in trading days) for the weekly RV component. Defaults to 5.5
monthly_windowintThe trailing window (in trading days) for the monthly RV component. Defaults to 22.21
horizonintThe number of days ahead to forecast. Defaults to 1.5
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the HAR-RV forecast values over time. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
Share