Full text
Do Google Trends Forecast Bitcoins? Stylized Facts and Statistical Evidence Argimiro Arratia1and Albert X. L´opez Barrantes2 1Universitat Polit`ecnica de Catalunya, Dept. of Computer Science, Barcelona, SPAIN [email protected] 2Universitat Aut´onoma de Barcelona, SPAIN [email protected] Abstract. In early 2018 Bitcoin prices peaked at US$ 20,000 and, almost two years later, we still continue debating if cryptocurrencies can actually become a currency for the everyday life or not. From the economic point of view, and playing in the field of behavioral finance, this paper analyses the relation between Bitcoin prices and the search interest on Bitcoin since 2014. We questioned the forecasting ability of Google Bitcoin Trends for the behavior of Bitcoin price by performing linear and nonlinear dependency tests, and exploring performance of ARIMA and Neural Network models enhanced with this social sentiment indicator. Our analyses and models are founded upon a set of statistical properties common to financial returns that we establish for Bitcoin, Ethereum, Ripple and Litecoin. Keywords: Google Trends, Bitcoin, causality, ARIMA, Neural Networks 1 Introduction Bitcoin is the most popular and prominent cryptocurrency in the world. The first design was published in 2008 under the pseudonym of Satoshi Nakamoto [13]. A currency where everyone from anywhere can execute transactions with no need of a traditional financial institution involved in the process generated a huge expectation around the world rising Bitcoin prices to a peak of US$ 20,000 in January 2018. However, the low number of transactions per second that are able to support and the non-recognition as a currency by most companies and governments, caused a big drop in the price to the current US$ 3,000 price. A new economic bubble in the exact sense of the term: a huge increase on expectations on a short period of time, often coming from the irrational decisions we do as human beings. We can indeed observe that a classical financial bubble have formed on the Bitcoin price time series (Figure 1 left). And with the intention to build upon research on the use of big data in social media to construct predictors for various economic variables or social events as in, for example, [1, 3, 8] and most relevant for this project the paper [6], we looked at the trend of the topic
2 “bitcoin” in Google Trends for the last four years, and obtained the time series depicted in Figure 1 (right). Fig. 1. Bitcoin prices and Google Trends on topic “bitcoin” series The strong resemblance among both time series may lead one to think of the Google Bitcoin Trends (GBTrends) as predictor of Bitcoin price behavior. But being cautious about drawing conclusion from pictures and aware of the failure of the Google Flu Trends [11], we turn to traditional statistical methods to prove hypothesis. 2 Stylized empirical facts and statistical issues Financial time series have a common set of characteristics that should be studied and considered before any further analysis, modelling or conclusions. These are commonly known as stylized empirical facts [4], and knowing which of these hold will guide on proper modeling of the financial asset. However, a basic underlying hypothesis is that of stationarity, and more often than not, these data sets are non stationary which means that we have to transform them, usually by considering returns, in order to recognize some statistical properties of the data which remain invariant over time, and so that modeling is possible. 2.1 Data gathering We obtained Bitcoin prices from CoinMarketCap.com. The data set contains Bitcoin daily prices since 2014 with access to Open and Closing prices as well as volume traded and the total market capitalization over time. On the other hand, Google Trends on the word “Bitcoin” can be obtained through the R package gtrendsR where one can query everything with the same parameters over time and geography as in the web page of Google Trends. One has only to take into account the minimum time scale one can get from Google Trends, which for this paper we got a weekly time scale since 2014.
3 2.2 Stationarity Kendall [10] was the first one to realize financial time series are seldom stationary. To get close to be stationary, or at least to be second-order stationary, a common technique is to apply successive differences to the series. Hence, it is recommendable to work instead with the series logarithmic returns: rt= log Pt Pt−1. There are several tests for stationarity and a few for second order stationarity; a survey of the former kind of stationarity and a proposal for the latter can be seen in [15]. In this work we applied two tests for second order stationarity: the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test with null hypothesis that an observable time series is stationary around a deterministic trend; and the Priestley-Subba-Rao (PSR) test that investigates how “non-constant” the timevarying Fourier spectrum of the series is. The KPSS is implemented in the Rpackage tseries test, and PSR is implemented in fractal package. Table 1. Priestley-Subba-Rao (PSR) test series p-value for T Bitcoin returns 3.74812e-05 Ethereum returns 0.001743593 Ripple returns 2.279732e-12 Litecoin returns 4.931523e-08 GBTrends returns 0 We ran both tests for all four cryptocurrencies and GBTrends returns, and for all the null hypothesis of stationarity was rejected. Hence modeling is in principle in this context not statistically well-founded. 2.3 Aggregational Gaussianity One of the most used conventions when working with financial data is the assumption that returns are log-normally distributed, which is equivalent to the assumption that log-returns are normally distributed. Early in 1953 Kendall, Mandelbrot in 1960 or Fama in 1965, among other researchers, signaled the non normal distribution of asset returns and the heavy tails [10, 5]. However, it is remarkably important that distributions become closer to normal when the timescale increases. This convergence in distribution towards normality as timescale increases is called Aggregational Gaussianity and is widely documented across assets around the world. In our case, we checked for this phenomenon in all cryptocurrencies returns series. For Bitcoin daily returns we found the typical leptokurtic distribution, sharp peaked and heavy tailed, which is far from being normally distributed. However, once we increase the timescale to weekly samples, the distribution gets closer
4 Fig. 2. Weekly (left) and monthly (right) bitcoin returns estimated density (dashed line) and normal density fit (solid line) to a normal distribution. It is no until we get the monthly returns distribution when we closer to a normal distribution. On the timescale of weekly returns, if we try to fit the GBTrends series we get a similar shape as the weekly Bitcoin prices, far from a normal shape with considerable fat tails and a considerable peak, which can be observed also in the skewness comparative at the end. However, a visual analysis is not enough to say if the aggregational gaussianity is happening on cryptocurrency’s returns. To properly check this, we will use Shapiro-Wilk and Jarque-Bera normality tests on different time scales of Bitcoin, Ethereum, Ripple and Litecoin returns. The null hypothesis of ShapiroWilk normality test is data is normally distributed, and the null hypothesis of Jarque-Bera test is a joint hypothesis of skewness = 0 and excess kurtosis = 0. Overall, Bitcoin returns is in line with literature on Aggregational Gaussianity, the more we increase the timescale, the closer we get to have log normal returns, specifically when we reach a monthly times scale. For the other three cryptocurrencies results are more extreme, since we only get normality once we reach yearly returns in Jarque-Bera test. Since our data starts at 2014 for all cryptocurrencies and GBTrends, yearly returns are calculated on 5 observations, which invalidates any results of these tests of this timescale. The work by Chan et al [2] goes a step further by fitting non-normal distributions to each of the cryptocurrencies. They find that for Bitcoin and Litecoin, the generalized hyperbolic distribution gives the best fit, while the other cryptocurrencies return distributions are better fitted by the normal inverse Gaussian, generalized tand Laplace distributions. 2.4 Autocorrelations We now check the possibility of self linear association of the cryptocurrencies return time series, by computing the ACF and PACF. The auto-correlation function (ACF) gives us the values of autocorrelation between the time series and its lagged values. The partial auto-correlation function (PACF) gives the correlation values of the residuals with the next lag value.
5 Table 2. Normality tests Data Shapiro-Wilk Jarque-Bera p-value p-value Weekly returns GBTrends 0.00001 0.00001 Daily returns Bitcoin 0.00001 0.00001 Weekly returns Bitcoin 0.00006 0.00001 Monthly returns Bitcoin 0.03808 0.07850 Quarterly returns Bitcoin 0.00633 0.01168 Yearly returns Bitcoin 0.00126 0.20780 Daily returns Ethereum 0.00001 0.00001 Weekly returns Ethereum 0.00001 0.00001 Monthly returns Ethereum 0.00002 0.00001 Quarterly returns Ethereum 0.00004 0.00001 Yearly returns Ethereum 0.00103 0.40190 Daily returns Ripple 0.00001 0.00001 Weekly returns Ripple 0.00001 0.00001 Monthly returns Ripple 0.00001 0.00001 Quarterly returns Ripple 0.00001 0.00001 Yearly returns Ripple 0.00002 0.16900 Daily returns Litecoin 0.00001 0.00001 Weekly returns Litecoin 0.00001 0.00001 Monthly returns Litecoin 0.00001 0.00001 Quarterly returns Litecoin 0.00001 0.00001 Yearly returns Litecoin 0.00009 0.17430 Visualizing the ACF and PACF for Bitcoin and Google Bitcoin Trends returns, we can not observe any significant auto-correlations in both series (Figure 3). These results are in line with financial literature, where it is a common characteristic the lack of auto-correlation, and widely supported by “The Efficient Market Hypothesis”. In a competitive market where participants use all available information, market prices should be very close to the intrinsic value of the company, leaving very few opportunities to arbitrage [5]. Computing ACF and PACF for the other top three cryptocurrencies, we see that Ripple and Litecoin show no significant autocorrelation, while Ethereum have some positive autocorrelations around lag 3 (Figure 4). 2.5 Volatility clustering Volatility clustering refers to the observation, first noted by Mandelbrot [12], that “large changes tend to be followed by large changes, of either sign, and small changes tend to be followed by small changes.” This is tested computing the ACF and PACFs of the squared of returns. It is generally expect that log returns to be serially uncorrelated, but the squared log returns to show significant autocorrelations. This is the case for the four cryptocurrencies but not for Google
6 Fig. 3. ACF and PACF of Bitcoin, GBTrends and Ethereum returns Fig. 4. ACF and PACF of Ripple and Litecoin returns
7 Bitcoin Trends: while Bitcoin, Ethereum, Ripple and Litecoin squared log returns show significant autocorrelations, GBTrends squared returns does not. 2.6 Causality When analyzing relationships between time series, correlation only captures the linear dependency between two variables, but one would like to know in which direction the information flows from one series to the other. In other words, if Bitcoin prices and GBTrends are correlated we want to know which one causes the move of the other. In this context potential outcomes could be: a) The interest in Bitcoin around the world and captured by Google Trends is actually a good proxy for measuring the social interest on the cryptocurrency triggering a Bitcoin price movement. b) Big swings on Bitcoin prices create media and social attention triggering an increase in the interest of people around Bitcoin. c) A combination of both events, were both series move at the same time and direction, up or down. d) There is no relation at all between them and none of them influences the other. We measure causality using Granger causality test [7]. The basic idea of Granger causality is that Xcauses Y, if Ycan be better predicted using the histories of both Xand Ythan it can by using the history of Yalone. Formally one consider a bivariate linear autoregressive model on Xand Y, making Ydependent on the history of Xand Y, together with a linear autoregressive model on Y, and then test for the null hypothesis of “Xdoes not causes Y”, which amounts to test that all coefficients accompanying the lagged observations of Xin the bivariate linear autoregressive model are zero. Then, we can evaluate the null hypothesis through an F-test. To perform this test on our time series we have used the R package MSBVAR which provides methods for estimating frequentist and Bayesian Vector Autoregression (VAR) models and other tools such as the Bivariate Granger Causality Test. We perform this test at four different epochs marked by full calendar years 2015, 2016, 2017, 2018, and sampling weekly returns. Lag lengths considered to compute this test were the first 4 lags, to cover any autocorrelation through the month. We run the causality test for GBTrends, Bitcoin, Ripple and Litecoin returns (Ethereum has not been included in this analysis because of the lack of historical data, since it started to trade in late 2015, and low volume of trade). Table 3 shows the results for GBTrends and Bitcoin for 2017. We see significant causality from GBTrends to Bitcoin in all four lags. This is also the case for the year 2015 (although only for lag 1), but not for 2016 and 2018 where rather contemporaneous correlation (causality in both directions) has been shown at all lags. A quick explanation of these results is that as the hype for Bitcoin was building up, both GBTrends and Bitcoin were moving each other, but as the Bitcoin prices started to rise exponentially news started to anticipate the
8 next jump until the peak in 2017-2018. At that point the curiosity on the topic was globally widespread, leading to an increase in searches in Google on this cryptocurrency due to its incredibly high price. Table 3. Granger Tests results for 2017 Lag length used 1 lag 2 lags 3 lags 4 lags Causal relations p-val p-val p-val p-val GBTrends to BTC 0.2740 0.1156 0.1052 0.1985 BTC to GBTrends 0.0030 0.0130 0.0168 0.0342 Table 4 shows causality results for GBTrends, Ripple and Litecoin for year 2017. Here we observe causality in both directions (GBTrends to and from the cryptocurrencies). This situation is more or less the same on the other epochs considered. A plausible explanation could be that these two cryptocurrencies do not induce massive searches, and are somewhat surrogates for Bitcoin. Table 4. Granger Tests results for 2017 Lag length used 1 lag 2 lags 3 lags 4 lags Causal relations p-val p-val p-val p-val GBTrends to XRP prices 0.1687 0.3184 0.2668 0.3486 GBTrends to LTC prices 0.9368 0.7929 0.8024 0.9205 BTC prices to XRP prices 0.3262 0.6521 0.6598 0.3956 BTC prices to LTC prices 0.3862 0.6928 0.8505 0.8956 XRP prices to GBTrends 0.8432 0.7538 0.8005 0.8803 LTC prices to GBTrends 0.3827 0.7749 0.2705 0.4101 2.7 Neglected nonlinearity A multivariate test of nonlinearity to ascertain if two time series are nonlinearly related can be achieved with the neural network test for neglected nonlinearity developed by White [14]. The basic idea is to perform a test of the hypothesis that a given neural network defines a perfect mapping between its input and output and that all the errors are due to randomness. For our experiments we use the Ter¨asvirta linearity test, presented in [16] and based on Whites neural network test for neglected nonlinearity. An implementation of this algorithm is available in the tseries R library. Again we only have space to show results for 2017 in Table 5. The null is the hypotheses of linearity in mean. Then, results from Teraesvirta test indicate
9 existence of a non-linear map from GBTrends to Bitcoin. The presence of a nonlinear relation justifies the use of non-linear models such as neural networks that profit from all those existing relations between time series. Table 5. Terasvirta Neural Network Tests results 2017 X-squared p-value Bitcoin to GBTrends 5.8703 0.0531 GBTrends to Bitcoin 2.8758 0.2374 Bitcoin to Ethereum 0.002 0.9989 Bitcoin to Ripple 2.111 0.3479 Bitcoin to Litecoin 0.9126 0.6336 GBTrends to Ethereum 0.7732 0.6794 GBTrends to Ripple 0.1757 0.9159 GBTrends to Litecoin 3.0942 0.2129 3 Modelling To sum up, we have seen the stylized facts for Bitcoin prices (and other three cryptocurrencies) and Google Bitcoin Trends. As expected, both of them share most characteristics seen in stock market literature: –Both time series are non stationary, so further statistical analysis are performed on their returns time series. As well as Bitcoin, Ethereum, Ripple and Litecoin are not stationary. –Bitcoin returns series converge to normality when increasing the sampling period. The other three major cryptocurrencies Ethereum, Ripple and Litecoin do not converge to normality. –Bitcoin prices and GBTrends returns time series do not experience autocorrelation with their first few lags. –GBTrends has a significant causal effect on Bitcoin price changes at certain epochs (2015 and more strongly at 2017), so there could be some value in GBTrends as predictor. Other epochs, and for most of the cryptocurrencies we observe contemporaneous correlations, among themselves and with GBTrends. With this information, our approach in this section is to test predictability on top of some models. To do so we will be using a control model, only using past information from Bitcoin returns and comparing errors against models using GBTrends series as external variables to predict. We used Bitcoin price changes on a weekly timescale. This is forced by the fact that we could only get Google Trends data on a weekly time scale.