# Hybrid Forecasting Models Based on the Neural Networks for the Volatility of Bitcoin
## 2 Material and Methods  
The time series data analyzed in this paper were the daily historical prices of Bitcoin over the period between 1 January 2012 and 30 November 2019. The data were downloaded from the website (https://bitcoin charts.com/). To define the volatility of Bitcoin price, the closing prices \(p_{t}\) at time \(t\) are transformed into log return \(r_{t}=\log p_{t}-\log p_{t-1}\). The realized volatility of Bitcoin was computed as the variance of \(r_{t}\), and the realized volatilities in a 5-day window as weekly volatilities are used to analyze the volatility of Bitcoin in this paper. Then, the realized volatility \((RV_{t})\) of Bitcoin at time \(t\) is computed as  
\[RV_{t}=\frac{1}{5}\sum_{i=t+1}^{t+5}(r_{i}-\overline{r}_{t})^{2},\]  
where \(\overline{r}_{t}\) is mean of \(r_{t}\) during 5 days after time \(t\). In order to improve the accuracy of the volatility forecast, the selection of the input data which influence on the volatility of Bitcoin is very important. In this paper, we consider the GT data and VIX data as the explanatory variables. GT is the data that presents the popularity of search queries related to various sectors in Google. In fact, GT data has been used as explanatory variables in the ANN to forecast of the financial time series by many researchers [34, 42, 43, 44]. We used 'Bitcoin' GT data as the input variable, which is a good measure to describe the Bitcoin market [45]. VIX index introduced the Chicago Board Options Exchange (CBOE) in 2004 extrapolates the future volatility from the liquid options written on the S&P 500 and is calculated as the square root of the risk-neutral expectation of the 30 days variance of the S&P 500 return which is estimated by the forward option price expiring in 30 days. From the previous works [46, 47], we can find the significant relationship between the VIX index and Bitcoin. Thus, we choose the VIX index as the input data to the ANN-based on the researches. Specifically, 5-days moving averages of VIX index and GT data are used as the input data. In Figure 3, the time series of log return \(r_{t}\) of Bitcoin price are displayed. Figures 4 and 5 illustrate the realized volatility of bitcoin price and VIX index, respectively. Figure 2: The structure of Higher Order Neural Network (HONN). Figure 4: Realized volatility \(RV_{t}\) of \(r_{t}\) from 1 January 2012 to 30 November 2019. Figure 3: Log return \(r_{t}\) of Bitcoin price from 1 January 2012 to 30 November 2019. In order to construct a more accurate model for forecasting of Bitcoin volatility, we use the 1-day lagged weekly volatility (\(LV_{t}\)) as the endogenous variable and the outputs of GARCH family models as the exogenous variables. In other words, \(LV_{t}\) and GARCH family outputs are used as the input variables to improve the forecasting ability of the hybrid model. Here, the outputs of the GARCH models introduced in the previous section are used, and \(LV_{t}\) is calculated by  
\[LV_{t}=\frac{1}{5}\sum_{i=t-1}^{t-5}(r_{i}-\bar{r}_{t})^{2}. \tag{6}\]  
Note that days in windows of \(LV_{t}\) have no intersection with 5 days in windows of \(RV_{t}\). \(LV_{t}\) is displayed in Figure 6. In this study, 80% of the data set (in-sample: 2012.01.01-2018.04.30) are used for training, and 20% (out-of-sample: 2018.05.01-2019.11.30) of the data set are used for testing. All experiments are implemented using Python 3. Additionally, we utilize three measures to compare the performance of the proposed models. These measures are the mean absolute error (MAE), the root mean square error (RMSE) and the mean absolute percentage error (MAPE) and as follows. \[\text{MAE}=\frac{1}{n}\sum_{t}|\sigma_{t}-RV_{t}|,\] \[\text{RMSE}=\left(\frac{1}{n}\sum_{t}(\sigma_{t}-RV_{t})^{2} \right)^{1/2},\] \[\text{MAPE}=\frac{1}{n}\sum_{t}\left|\frac{\sigma_{t}-RV_{t}}{RV_ {t}}\right|,\]  
where \(\sigma_{t}\) is the predicted volatility of Bitcoin and \(n\) is the number of the predicted data. Obviously, the lower values of the measures, the better accuracy of the model. For more details, see [48].