Calculates volatility forecasts based on the GARCH model.

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.

Also known as: GARCH, volatility clustering, conditional heteroscedasticity.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the GARCH Volatility Model for you. Just ask in plain English.

Calculate the GARCH Volatility Model in Python

The GARCH Volatility Model is available in the Risk module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_garch as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.risk.get_garch(period="quarterly")

Which returns:

Date AMZN TSLA Benchmark
2024Q2 0.0267 0.1602 0.008
2024Q3 0.0266 0.151 0.0069
2024Q4 0.0265 0.163 0.0064
2025Q1 0.0266 0.1912 0.0056
2025Q2 0.0266 0.1692 0.0052
2025Q3 0.0266 0.1567 0.0065
2025Q4 0.0265 0.1714 0.0066
2026Q1 0.0265 0.1495 0.0058
2026Q2 0.0265 0.1523 0.0054
2026Q3 0.0266 0.1507 0.0083

Parameters

get_garch 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 initialised with quarterly=True, otherwise “yearly”.
  • time_steps (int, optional): Time steps to calculate GARCH for.
  • optimization_t (int, optional): Time steps to optimize GARCH for. It is only used if no weights are given.
  • within_period (bool, optional): Whether to calculate GARCH within the specified period or for the entire period. Thus whether to look at the GARCH within a 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 4.
  • 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.

The Risk module page introduces the module, and the sidebar lists all of its functions.

Share