AI for Trading Series №5: Volatility

Learn about stock volatility, ARCH and GARCH model and how GARCH model analyzes volatility.

Purva Singh
Dec 10, 2020 · 4 min read
Photo by Jayden Staines on Unsplash

Volatility

Volatility can be used for :

  • Measuring risks
  • Defining position sizes
  • Designing alpha factors
  • Pricing options
  • Trading volatility directly

Historical Volatility

Historical Volatility. (Source: AI for Trading nano degree course on Udacity)

Annualized Volatility

Annualized Volatility. (Source: AI for Trading nano degree course on Udacity)

Python implementation of calculating which company has the maximum volatility based on its prices can be found here.

Conversion between monthly/daily log returns to annual log returns

Conversion Formula. (Source: AI for Trading nano degree course on Udacity)

Rolling Window

Rolling Window Approach. (Source: AI for Trading nano degree course on Udacity)

Python implementation of using rolling-window strategy to calculate average can be found here.

Exponentially Weighted Moving Average

Exponentially Weighted Moving Average. (Source: AI for Trading nano degree course on Udacity)

The formula for calculating exponentially weighted moving average is as follows :

Representation of Exponentially Weighted Moving Average. (Source: AI for Trading nano degree course on Udacity)

Here, r_n is the nth daily return and sigma_n is the nth estimate of the volatility. Lambda is a constant between 0 and 1 that defines how quickly weights on older data should decrease.

A high value of lambda (close to 1) will cause older data to matter relatively more in the calculation of sigma_n. A very low value of lambda would mean that the recent data matters more — in this case, the successively daily estimates of sigma_n themselves will be volatile.

ARCH and GARCH Models

The ARCH Model

  • ARCH : Autoregressive Conditional Heteroscedastic.
  • Autoregressive : Current values are somehow related to recent past values.
  • Heteroscedastic : Variable that we are trying to model, may have different magnitudes of variability at different time points. Magnitude of variability is measured using variance. Read more about Heteroskedasticity in my post here.
  • In an ARCH model, we must specify a lag parameter (m), to define the number of prior residual errors to include in the model.

ARCH models can be expressed as :

Representation of the ARCH Model. (Source: AI for Trading nano degree course on Udacity)

The GARCH Model

  • The GARCH model is an extension of ARCH model. It includes lag residual (m) terms together with lag variance terms (n). It incorporates moving average component together with the autoregressive component.
  • A typical GARCH model can be expressed as the figure below. An example of GARCH model of the first order could be expressed as GARCH(1,1). A GARCH(0, m) model is equivalent to ARCH(m) model.
Representation of the GARCH Model. (Source: AI for Trading nano degree course on Udacity)

This article is a part of my ‘AI for Trading’ Series. You can find the link to previous articles from the series: https://thestockgram.com/blog

References

  1. How to Model Volatility with ARCH and GARCH for Time Series Forecasting in Python’ by Jason Browniee.
  2. AI for Trading GitHub: Volatility

The Startup

Get smarter at building your thing. Join The Startup’s +740K followers.