[PLUS] How To Develop a GARCH Volatility Model for Bitcoin Prices
GARCH Volatility Modeling
It has been shown and well documented that financial time series have changing periods of variance (volatility) and often exhibit fat tailed distributions, and Bitcoin is no exception. Due to the change in volatility over different time periods (a technical term referred to as "heteroskedasticity"), GARCH (which stands for the Generalized AutoRegressive Conditional Heteroskedasticity) takes into account a long run average of volatility, a previous periods' volatility, and an error term. We will quote directly from the research published by Robert Engle below:
The GARCH model that has been described is typically called the
GARCH(1,1) model. The (1,1) in parentheses is a standard notation in which
the first number refers to how many autoregressive lags or ARCH terms
appear in the equation, while the second number refers to how many moving
average lags are specified which here is often called the number of GARCH
terms. Sometimes models with more than one lag are needed to find good
Although this model is directly set up to forecast for just one period, it
turns out that based on the one period forecast a two period forecast can be
made. Ultimately by repeating this step, long horizon forecasts can be
constructed. For the GARCH(1,1) the two step forecast is a little closer to the
long run average variance than the one step forecast and ultimately, the
distant horizon forecast is the same for all time periods as long as a + b < 1.
This is just the unconditional variance. Thus the GARCH models are mean
reverting and conditionally heteroskedastic but have a constant
Model Implementation in Python
We are going to use the Bitcoin time series from FTX on our site in order to construct our model. (*Consider how this could be extended for other cryptocurrencies!) We will also use help from the arch library. One of the first steps in our process (after loading the data), is to compute the log returns over each time period. In this model example, we will use all previous data to train the model and make a forecast for the following day. (There are multiple theories and practices for the best way to fine tune the parameters and build a model.) Of course, all of our code is commented line by line so that you can follow what is going on! Also, this working example with Bitcoin can be easily extended to other cryptocurrencies and fit to your purpose.
This is a premium post. Create Plus+ Account to view the live, working codebase for this article.
Notice: Information contained herein is not and should not be construed as an offer, solicitation, or recommendation to buy or sell securities. The information has been obtained from sources we
believe to be reliable; however no guarantee is made or implied with respect to its accuracy, timeliness, or completeness. Author does not own the any crypto currency discussed. The information
and content are subject to change without notice. CryptoDataDownload and its affiliates do not provide investment, tax, legal or accounting advice.
This material has been prepared for informational purposes only and is the opinion of the author, and is not intended to provide, and should not be relied on for, investment, tax, legal,
accounting advice. You should consult your own investment, tax, legal and accounting advisors before engaging in any transaction. All content published by CryptoDataDownload is not an