[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
THE PERFORMANCE OF TRADING SYSTEMS IS BASED ON THE USE OF COMPUTERIZED SYSTEM LOGIC. IT IS HYPOTHETICAL.
PLEASE NOTE THE FOLLOWING DISCLAIMER.
CFTC RULE 4.41: HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL
PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN
EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS,
SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE
DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY
TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN. U.S. GOVERNMENT REQUIRED DISCLAIMER: COMMODITY FUTURES
TRADING COMMISSION. FUTURES AND OPTIONS TRADING HAS LARGE POTENTIAL REWARDS, BUT ALSO LARGE POTENTIAL RISK.
YOU MUST BE AWARE OF THE RISKS AND BE WILLING TO ACCEPT THEM IN ORDER TO INVEST IN THE FUTURES AND OPTIONS MARKETS.
DON’T TRADE WITH MONEY YOU CAN’T AFFORD TO LOSE. THIS IS NEITHER A SOLICITATION NOR AN OFFER TO BUY/SELL FUTURES
OR OPTIONS. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES
SIMILAR TO THOSE DISCUSSED ON THIS WEBSITE. THE PAST PERFORMANCE OF ANY TRADING SYSTEM OR METHODOLOGY IS NOT
NECESSARILY INDICATIVE OF FUTURE RESULTS.