Modeling the dynamics of volatility in crypto and traditional markets.

Olga Lazunina
Beyond finance
Published in
8 min readMay 23, 2018
Photo by Paul Gilmore on Unsplash

Introduction and objectives: The idea of this research is to continue studying the behaviour of the innovative crypto market while studying the modern forecasting techniques. When we are talking about the future, we are thinking about the prediction range and forecasting volatility (see Poon and Granger (2003)) is likely the main component in this range. There are multiple ways of applying volatility in risk management. For example, solving the optimization problem in modern portfolio theory where the variances are the input variables and portfolio weights are the output. Estimating the risk measures (such as VaR, CVaR, Sharpe Ratio etc.) that will guide you through the possible future losses and gains. Volatility explicitly can be also one of the technical indicators in your trading model like, for instance, in this strategy.

Considering that volatility of cryptocurrencies might be captured by well-known models the longer it has been traded in the market, the key difficulty is the assumption about the future distribution in order to model the crypto time-series with those models. In this article I am going to implement my assumptions with GARCH, GJR GARCH and TARCH models, iterate through several distributions to obtain different forecasts and find the most accurate forecast. The time-series data set consists of S&P 500 index that represents US economy, Bitcoin crypto and NVIDIA stock prices. The historical sample includes data from May 13, 2013 to May 13, 2018.

A roadmap for this article is as follows. First, investigate the conditions that allow to apply GARCH-type models in the crypto market. Second, study the univariate behaviour of volatility as deterministic process and fit different theoretical distributions to empirical data. Third, make an assumption about future distribution. Finally, forecast 1-day ahead and compare the performance of models in the crypto market and in the stock market.

First, what is volatility? An essential question supplied with many possible answers that have dispersed themselves. Simply, it is a risk metric measured as a standard deviation of historical data. That is historical volatility. In contrast, implied volatility represents an expectation of future volatility often used in the option market. Realized volatility likewise historical volatility only measures intraday volatility in a high frequency trading. In turn, we model conditional volatility, which is the expectation of the future volatility given the past data. Indeed, the volatility is unobservable. What we can do with volatility is estimation. The models for estimation vary depending on the assumptions about the underlying processes such as deterministic or stochastic processes (for example, the price movement). Specifically, I will study GARCH-type models that represent volatility as an autoregressive deterministic process with heteroscedastic errors which means their volatility is not constant over time.

Why GARCH-type models? The GARCH-type models are well-known models. The presence of both components enables to model volatility clustering so that high volatility periods are followed by low volatility periods. Specifically, the GJR GARCH model integrates in additional term the effect of asymmetry in volatility when volatility is stronger from negative news. TARCH model is built on absolute values, meaning that it is more irrelevant to high volatility shocks which are exacerbated in squared terms in GARCH and GJR GARCH. Overall, GARCH-type models are well studied in the literature. See, for instance, Zivot (2008), Zhou and Sun (2013) and some recently published papers about the application of these models in the crypto market by Liu et al. (2017) and Estrada (2017).

Data: First, let’s have a look at data set which consists of BTC (from Kraken crypto exchange extracted via Cryptocompare.com API), NVDA (from NASDAQ via google finance API) and S&P 500 index (from yahoo finance). Figure 1 represents the prices and raw returns for every asset. The original price series are not stationary. That is why we convert them to returns. From Figure 1 we observe the volatility clustering in all data.

Figure 1: represents close (adjusted close) prices, returns and squared returns of S&P 500, BTC and NVDA series from May 2013 to May 2018.

Briefly, the descriptive statistics for observing data set in Table 1 shows the evidence of excess kurtosis and, therefore, fat-tails in the distribution of data. The results of Jarque-Bera test support the rejection of the null hypothesis that data are normally distributed:

Table 1: represents descriptive statistics and test for normality of data.

Figure 2 represents the histograms with fitted distributions to empirical data. The top panel shows how poorly the normal distribution fits to data, while the bottom panel — the best fitted distribution derived from 90 distributions in scipy.stats Python library. In terms of Bitcoin the most fitted distributions were: generalized normal distribution, Cauchy and Johnson’s S.

Figure 2: represents the histograms and fitted distribution (normal distribution — the top panel, the best fitted distribution — the bottom panel) to return series of S&P 500, BTC, NVDA from May 2013 to May 2018

Autocorrelation and distribution. Here we study different patterns of autocorrelation depicted for 21 lag . None of the plot shows significant serial correlation in returns which means the lack of linear dependence. However, the nonlinear dependence presented by squared returns is depicted in Figure 5 in the Appendix. There we observe stronger autocorrelation. A wave-shape decay in ACF and exponential decay in PACF of S&P 500 series constitute the presence of both AR and MA terms of higher orders. In contrast, BTC series are unlikely to follow any pattern. The series is non-stationary, with some randomness in the middle lags. There persists the constant low level of autocorrelation close to random which is hardly predictable. The sharp decay in PACF suggests to add AR(1) term to the model. In contrast, NVDA shows the classic view of a stationary series with MA and AR character. It could be well predicted by AR(1) and MA(1) processes. So, we expect the highest level of predictability by GARCH models specifically for NVDA time-series.

To sum up, in order to apply the GARCH-type models I find out enough premises such as volatility clustering (well observed in return series), fat-tailed distributions (as observed on the histograms), the autoregressive character of volatility or the long memory of volatility and heteroscedasticity in volatility or time-varying volatility from autocorrelation plots.

Next, setting up the model. As a guide for GARCH and GJR GARCH models in Python I followed Python for Econometrics by Kevin Sheppard and Quantopian lectures. TARCH model was implemented accordingly. The size of the train and test window is fixed at 70–30% of the data. First, the model the parameters estimates for train sample are presented in Table 2. The results provide the insight that on an in-sample data TARCH model shows the best fit for S&P 500 and NVDA series, while GJR GARCH for BTC series according to log likelihood and AIC criteria:

Table 2: model selection for S&P 500 series, log likelihood is estimated on period from May 2013 to May 2017.

The estimated parameters are then used to forecast 1 day ahead. The complexity here is to model the future distribution. In this article we make several assumptions about future distributions. The historical distributions of bitcoin and NVDA are noisy, so that if we plot the best fitted distribution according to empirical data which for BTC is generalised normal distribution with fitted parameters (beta=0.678, location=0.036, scale=1.372) it will scale up the noisy variance. So in this article we decide to build our forecast based on the distribution of S&P500 series which is also generalised normal with fixed parameters (beta=0.97, location=0.049, scale=0.529) and compare the predicted values with those obtained from normal distribution. The forecast is based on Monte Carlo simulation of 1000 trials and allow us to get the finite sample properties for forecast errors and confidence bands of volatility. Figure 3 shows historical data and predicted simulated data on one plot accompanied with moving average volatility for 21 day and confidence bands for the forecasted values of volatility. We observe that moving average model underestimates the high spikes of volatility in historical sample. In out-of-sample the simple moving average is likely to underestimates the volatility in spite of ability to capture the high market volatility in a short-term as in February 2018:

Figure 3: for S&P 500 historical and simulated draws of predicted values for returns and volatility with confidence bands for volatility.

Figure 4 shows the predicted values for BTC volatility. Overall the out-of-sample GARCH model tends to overestimate the true volatility, while TARCH volatility, which is estimated on absolute terms rather than on squared terms, underestimates the risks and shows moderate response to the volatility shocks.

Figure 4: TARCH and GARCH simulated predicted volatility for bitcoin against the moving average.

In Table 3 the results for mean absolute error (MAE) shows that the lowest forecast error is given by TARCH model for S&P 500 series, while BTC forecasts shows the most extreme errors. In Table 4 provided for S&P 500 data I compare mean absolute error (MAE) and root mean squared error (RMSE) for all models between 2 distributions (generalised normal with fitted parameters and normal distribution with zero mean and unit variance) . The results show that models with the assumption of the generalised distribution outperform the models built on normal distribution assumptions.

Table 3: represent the forecast errors, in particular, mean absolute error (MAE) for GARCH, GJR GARCH and TARCH models for S&P 500, BTC and NVDA series
Table 4: compares the accuracy of 1 day ahead for 252 days with rolling window estimation procedure by models (GARCH, GJR GARCH and TARCH) based on root mean squared error (RMSE), mean absolute error (MAE) and interquartile error (IQR) for S&P 500 series

Conclusions: While applying GARCH-type models with unknown future distribution the predictions could be misleading. Initially, NVDA series give more evidence in favour of GARCH models, but the assumption about future distribution and noisy data distort this expectation. The results show evidence that both series S&P 500 and BTC could be modelled with the same distribution. Therefore, in the next article I am going to study co-integration of both series and observe the risk premium with regard to GARCH-in-mean model with exogenous variable. It is likely I will come back to the observed models with new assumption about the future distribution.

Thank you for your time and feedback!

Appendix:

Figure 3 shows the patterns of serial correlation in squared returns:

Figure 5: represents the autocorrelation and partial autocorrelation for daily squared returns of S&P 500, BTC, NVDA and Gold series from May 2013 to May 2018

Figure 4 P-values from Ljung Box test show no evidence of serial correlation in predicted residuals for S&P 500, the model captured well the autocorrelation up to the 40th lag:

Figure 6: Ljung Box test for autocorrelation in residuals of S&P 500 forecasted series

--

--