GARCH Volatility Forecast
Calculates sigma_2 forecasts.
GARCH (Generalized autoregressive conditional heteroskedasticity) is stochastic model for time series, which is for instance used to model volatility clusters, stock return and inflation. It is a generalisation of the ARCH models.
The forecasting with GARCH is done with the following formula:
\[\sigma_{l} ^{2} + (\sigma_{t} ^{2} - \sigma_{l} ^{2}) \cdot (\alpha + \beta) ^{t - 1}\]For more information about the method, see the following book:
- Finance Compact Plus Band 1, by Yvonne Seler Zimmerman and Heinz Zimmerman; ISBN: 978-3-907291-31-1
Also known as: volatility forecast, predicted volatility.
GARCH Volatility Forecast in Python
get_garch_forecast is part of the Risk module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_garch_forecast as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.risk.get_garch_forecast(period="quarterly")
Which returns:
| AMZN | TSLA | Benchmark | |
|---|---|---|---|
| 2026Q4 | 0.0267 | 0.1703 | 0.0053 |
| 2027Q1 | 0.0267 | 0.1703 | 0.0053 |
| 2027Q2 | 0.0267 | 0.1738 | 0.0056 |
| 2027Q3 | 0.0267 | 0.1745 | 0.0058 |
| 2027Q4 | 0.0266 | 0.1747 | 0.006 |
| 2028Q1 | 0.0266 | 0.1747 | 0.0062 |
| 2028Q2 | 0.0266 | 0.1747 | 0.0063 |
| 2028Q3 | 0.0266 | 0.1747 | 0.0064 |
| 2028Q4 | 0.0266 | 0.1747 | 0.0065 |
| 2029Q1 | 0.0266 | 0.1747 | 0.0066 |
Parameters
get_garch_forecast accepts the following parameters:
- period (str, optional): The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialized with quarterly=True, otherwise “yearly”.
- time_steps (int, optional): Time steps to calculate GARCH and to forecast sigma_2 values for.
- within_period (bool, optional): Whether to calculate GARCH within each specified period or all at once. Thus whether to look at the GARCH within each specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
- growth (bool, optional): Whether to calculate the growth of the GARCH values over time. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.