Fit a basic ARCH model to forecast volatility (all with Python)

Published: 2026-01-03

URL: https://pyquantnews.substack.com/p/price-options-with-better-volatility


Each week, I send out one Python tutorial to help you get started with algorithmic trading, market data analysis, and quant finance. Upgrade to a paid plan to access the code notebooks. Subscribe now In today’s post, you’ll fit a simple GARCH model in Python and turn it into a volatility forecast. Then you’ll compare it to a simple historical estimate and see how that changes an option’s fair value.

What GARCH does GARCH is a time-series model that forecasts volatility by learning how today’s volatility depends on recent shocks and past volatility. It became mainstream in finance after Tim Bollerslev formalized GARCH in 1986, building on earlier ARCH work by Robert Engle.

It stuck because returns show volatility clustering, and simple constant-volatility assumptions miss that behavior. How pros use it That same idea shows up today in real pricing and risk workflows where volatility is a key input to valuation models.

On an options desk, you’ll see a volatility estimate feed pricing checks that compare market option prices to model values, then flag rich or cheap volatility. On a risk team, you’ll see conditional volatility forecasts used to scale position limits or stress test a book when volatility starts rising.

In systematic trading, you’ll often see GARCH used as one component in a pipeline that also tracks realized volatility, implied volatility, and residual diagnostics so you can tell when the model is drifting.

Why it matters to you For you, GARCH is a practical way to stop treating volatility like a single historical statistic and start treating it like a forecast. It reduces common beginner errors like using a quiet-month standard deviation to price options during a high-volatility regime, then wondering why your “fair value” is consistently wrong. Let’s see how it works with Python. Library installation Install the libraries we need to download market data and fit a GARCH volatility model.

The arch package includes compiled components on some platforms, so if pip fails, try upgrading pip/wheel or installing via conda-forge in a conda environment. Imports and setup We use numpy for numeric transforms, yfinance to pull “AAPL” price history, and arch to fit a GARCH model.

In research notebooks, clean, repeatable plotting reduces the chance we misread regime changes because of inconsistent chart scales. It also helps when we start validating whether a volatility input is “too slow” after a market shift. Download prices and compute returns Pull adjusted close prices with yfinance and convert them into daily percentage returns, which is the standard input format for GARCH-style volatility models. Using the adjusted close helps us avoid artificial jumps from splits and dividends, which can contaminate volatility estimation.

We scale returns by 100 because many volatility libraries (including arch) conventionally work in percent units, and it makes model outputs easier to sanity-check. Fit GARCH to forecast volatility Fit a default GARCH model with arch and generate a one-step-ahead conditional variance forecast for the next trading day.

This is the core shift from “volatility as a single historical statistic” to “volatility as a forecast conditioned on recent shocks.” In options work, the difference matters because pricing is convex in volatility, so stale inputs can systematically misprice premiums when regimes change. Default settings are fine for a first pass, but in practice, we validate residuals and experiment with distributions (e.g., Student-t) before trusting the forecast in production. Convert variance into annual volatility Convert the variance forecast into a daily volatility estimate, then annualize it to match how options quotes and vol surfaces are typically expressed.

Taking the square root moves us from variance to volatility, which is what traders usually think in and what plugs into models like Black-Scholes. Annualizing with 252 trading days gives a like-for-like number to compare against implied volatility or a historical annualized standard deviation.

Finally, we divide by 100 when turning the annualized figure into a decimal volatility for pricing formulas. Your next steps To use your volatility forecast, you need to input it into an options pricing model. You can find a calculator online that computes the fair value of an option given current volatility levels.

For example, you might find AAPL’s annualized market volatility at 25%. If you believe your forecast (in today’s example, 21.5%), then the market is overpricing the option. You would sell the option in anticipation of the volatility converging to your forecast .