# Anticipating Cryptocurrency Prices Using Machine Learning

Authors: Laura Alessandretti; Abeer ElBahrawy; Luca Maria Aiello; Andrea Baronchelli
Journal: Complexity
 (2018)

---

## Abstract

Machine learning and AI-assisted trading have attracted growing interest for the past few years. Here, we use this approach to test the hypothesis that the inefficiency of the cryptocurrency market can be exploited to generate abnormal profits. We analyse daily data for1,681 cryptocurrencies for the period between Nov. 2015 and Apr. 2018. We show that simple trading strategies assisted by state-of-the-art machine learning algorithms outperform standard benchmarks. Our results show that nontrivial, but ultimately simple, algorithmic mechanisms can help anticipate the short-term evolution of the cryptocurrency market.


---

## Body

## 1. Introduction

The popularity of cryptocurrencies has skyrocketed in 2017 due to several consecutive months of superexponential growth of their market capitalization [1], which peaked at more than $800 billions in Jan. 2018. Today, there are more than 1,500 actively traded cryptocurrencies. Between 2.9 and 5.8 millions of private as well as institutional investors are in the different transaction networks, according to a recent survey [2], and access to the market has become easier over time. Major cryptocurrencies can be bought using fiat currency in a number of online exchanges (e.g., Binance [3], Upbit [4], Kraken [5], etc.) and then be used in their turn to buy less popular cryptocurrencies. The volume of daily exchanges is currently superior to $15 billions. Since 2017, over 170 hedge funds specialised in cryptocurrencies have emerged and Bitcoin futures have been launched to address institutional demand for trading and hedging Bitcoin [6].The market is diverse and provides investors with many different products. Just to mention a few, Bitcoin was expressly designed as a medium of exchange [7, 8]; Dash offers improved services on top of Bitcoin’s feature set, including instantaneous and private transactions [9]; Ethereum is a public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality, and Ether is a cryptocurrency whose blockchain is generated by the Ethereum platform [10]; Ripple is a real-time gross settlement system (RTGS), currency exchange, and remittance network Ripple [11], and IOTA is focused on providing secure communications and payments between agents on the Internet of Things [12].The emergence of a self-organised market of virtual currencies and/or assets whose value is generated primarily by social consensus [13] has naturally attracted interest from the scientific community [8, 14–30]. Recent results have shown that the long-term properties of the cryptocurrency marked have remained stable between 2013 and 2017 and are compatible with a scenario in which investors simply sample the market and allocate their money according to the cryptocurrency’s market shares [1]. While this is true on average, various studies have focused on the analysis and forecasting of price fluctuations, using mostly traditional approaches for financial markets analysis and prediction [31–35].The success of machine learning techniques for stock markets prediction [36–42] suggests that these methods could be effective also in predicting cryptocurrencies prices. However, the application of machine learning algorithms to the cryptocurrency market has been limited so far to the analysis of Bitcoin prices, using random forests [43], Bayesian neural network [44], long short-term memory neural network [45], and other algorithms [32, 46]. These studies were able to anticipate, to different degrees, the price fluctuations of Bitcoin, and revealed that best results were achieved by neural network based algorithms. Deep reinforcement learning was showed to beat the uniform buy and hold strategy [47] in predicting the prices of 12 cryptocurrencies over one-year period [48].Other attempts to use machine learning to predict the prices of cryptocurrencies other than Bitcoin come from nonacademic sources [49–54]. Most of these analyses focused on a limited number of currencies and did not provide benchmark comparisons for their results.Here, we test the performance of three models in predicting daily cryptocurrency price for 1,681 currencies. Two of the models are based on gradient boosting decision trees [55] and one is based on long short-term memory (LSTM) recurrent neural networks [56]. In all cases, we build investment portfolios based on the predictions and we compare their performance in terms of return on investment. We find that all of the three models perform better than a baseline ‘simple moving average’ model [57–60] where a currency’s price is predicted as the average price across the preceding days and that the method based on long short-term memory recurrent neural networks systematically yields the best return on investment.The article is structured as follows: In Materials and Methods we describe the data (see Data Description and Preprocessing), the metrics characterizing cryptocurrencies that are used along the paper (see Metrics), the forecasting algorithms (see Forecasting Algorithms), and the evaluation metrics (see Evaluation). In Results, we present and compare the results obtained with the three forecasting algorithms and the baseline method. In Conclusion, we conclude and discuss results.


## 2. Materials and Methods

### 2.1. Data Description and Preprocessing

Cryptocurrency data was extracted from the website Coin Market Cap [61], collecting daily data from 300 exchange markets platforms starting in the period between November 11, 2015, and April 24, 2018. The dataset contains the daily price in US dollars, the market capitalization, and the trading volume of 1,681 cryptocurrencies, where the market capitalization is the product between price and circulating supply, and the volume is the number of coins exchanged in a day. The daily price is computed as the volume weighted average of all prices reported at each market. Figure 1 shows the number of currencies with trading volume larger than Vmin over time, for different values of Vmin. In the following sections, we consider that only currencies with daily trading volume higher than 105 USD (United States dollar) can be traded at any given day.Figure 1
Number of cryptocurrencies. The cryptocurrencies with volume higher than Vmin as a function of time, for different values of Vmin. For visualization purposes, curves are averaged over a rolling window of 10 days.The website lists cryptocurrencies traded on public exchange markets that have existed for more than 30 days and for which an API and a public URL showing the total mined supply are available. Information on the market capitalization of cryptocurrencies that are not traded in the 6 hours preceding the weekly release of data is not included on the website. Cryptocurrencies inactive for 7 days are not included in the list released. These measures imply that some cryptocurrencies can disappear from the list to reappear later on. In this case, we consider the price to be the same as before disappearing. However, this choice does not affect results since only in 28 cases the currency has volume higher than105 USD right before disappearing (note that there are 124,328 entries in the dataset with volume larger than 105 USD).


### 2.2. Metrics

Cryptocurrencies are characterized over time by several metrics, namely,(i)
Price, the exchange rate, determined by supply and demand dynamics.(ii)
Market capitalization, the product of the circulating supply and the price.(iii)
Market share, the market capitalization of a currency normalized by the total market capitalization.(iv)
Rank, therank of currency based on its market capitalization.(v)
Volume, coins traded in the last 24 hours.(vi)
Age, lifetime of the currency in days.The profitability of a currencyc over time can be quantified through thereturn on investment (ROI), measuring the return of an investment made at day ti relative to the cost [62]. The index i rolls across days and it is included between 0 and 895, with t0= November 11, 2015, and t895= April 24, 2018. Since we are interested in the short-term performance, we consider the return on investment after 1 day defined as(1)ROIc,ti=pricec,ti-pricec,ti-1pricec,ti-1.In Figure2, we show the evolution of the ROI over time for Bitcoin (orange line) and on average for currencies whose volume is larger than Vmin=105 USD at ti-1 (blue line). In both cases, the average return on investment over the period considered is larger than 0, reflecting the overall growth of the market.Figure 2
Return on investment over time. The daily return on investment for Bitcoin (orange line) and the average for currencies with volume larger than Vmin=105 USD (blue line). Their average value across time (dashed lines) is larger than 0. For visualization purposes, curves are averaged over a rolling window of 10 days.


### 2.3. Forecasting Algorithms

We test and compare three supervised methods for short-term price forecasting. The first two methods rely on XGBoost [63], an open-source scalable machine learning system for tree boosting used in a number of winning Kaggle solutions (17/29 in 2015) [64]. The third method is based on the long short-term memory (LSTM) algorithm for recurrent neural networks [56] that have demonstrated to achieve state-of-the-art results in time-series forecasting [65].Method 1. The first method considers one single regression model to describe the change in price of all currencies (see Figure 3). The model is an ensemble of regression trees built by the XGBoost algorithm. The features of the model are characteristics of a currency between time tj-w and tj-1 and the target is the ROI of the currency at time tj, where w is a parameter to be determined. The characteristics considered for each currency are price, market capitalization, market share, rank, volume, and ROI (see (1)). The features for the regression are built across the window between tj-w and tj-1 included (see Figure 3). Specifically, we consider the average, the standard deviation, the median, the last value, and the trend (e.g., the difference between last and first value) of the properties listed above. In the training phase, we include all currencies with volume larger than 105 USD and tj between ti-Wtraining and ti. In general, larger training windows do not necessarily lead to better results (see results section), because the market evolves across time. In the prediction phase, we test on the set of existing currencies at day ti. This procedure is repeated for values of ti included between January 1, 2016, and April 24, 2018.Figure 3
Schematic description of Method 1. The training set is composed of features and target (T) pairs, where features are various characteristics of a currency ci, computed across the w days preceding time tj and the target T is the price of ci at tj. The features-target pairs are computed for all currencies ci and all values of tj included between ti-Wtraining and ti-1. The test set includes features-target pairs for all currencies with trading volume larger than 105 USD at ti, where the target is the price at time ti and features are computed in the w days preceding ti.Method 2. Also the second method relies on XGBoost, but now the algorithm is used to build a different regression model for each currency ci (see Figure 4). The features of the model for currency ci are the characteristics of all the currencies in the dataset between tj-w and tj-1 included and the target is the ROI of ci at day tj (i.e., now the algorithm learns to predict the price of the currency i based on the features of all the currencies in the system between tj-w and tj-1). The features of the model are the same used in Method 1 (e.g., the average, standard, deviation, median, last value, and difference between last and first value of the following quantities: price, market capitalization, market share, rank, volume, and ROI) across a window of length w. The model for currency ci is trained with pairs features target between times ti-Wtraining and ti-1. The prediction set includes only one pair: the features (computed between ti-w and ti-1) and the target (computed at ti) of currency ci.Figure 4
Schematic description of Method 2. The training set is composed of features and target (T) pairs, where features are various characteristics of all currencies, computed across the w days preceding time tj and the target T is the price of ci at tj. The features-target pairs include a single currency ci, for all values of tj included between ti-Wtraining and ti-1. The test set contains a single features-target pair: the characteristics of all currencies, computed across the w days preceding time ti and the price of ci at ti.Method 3. The third method is based on long short-term memory networks, a special kind of recurrent neural networks, capable of learning long-term dependencies. As for Method 2, we build a different model for each currency. Each model predicts the ROI of a given currency at day ti based on the values of the ROI of the same currency between days ti-w and ti-1 included.Baseline Method. As baseline method, we adopt the simple moving average strategy (SMA) widely tested and used as a null model in stock market prediction [57–60]. It estimates the price of a currency at day ti as the average price of the same currency between ti-w and ti-1 included.


### 2.4. Evaluation

We compare the performance of various investment portfolios built based on the algorithms predictions. The investment portfolio is built at timeti-1 by equally splitting an initial capital among the top n currencies predicted with positive return. Hence, the total return at time ti is(2)Rti=1n∑c=1nROIc,ti.The portfolios performance is evaluated by computing the Sharpe ratio and the geometric mean return. The Sharpe ratio is defined as(3)Sti=R¯sR,where R¯ is the average return on investment obtained between times 0 and ti and sR is the corresponding standard deviation.The geometric mean return is defined as(4)Gti=∏tj=1ti1+RtjT,where ti corresponds to the total number of days considered. The cumulative return obtained at ti after investing and selling on the following day for the whole period is defined as G(ti)2.The number of currenciesn to include in a portfolio is chosen at ti by optimising either the geometric mean G(ti-1) (geometric mean optimisation) or the Sharpe ratio S(ti-1) (Sharpe ratio optimisation) over the possible choices of n. The same approach is used to choose the parameters of Method 1 (w and Wtraining), Method 2 (w and Wtraining), and the baseline method (w).


## 2.1. Data Description and Preprocessing

Cryptocurrency data was extracted from the website Coin Market Cap [61], collecting daily data from 300 exchange markets platforms starting in the period between November 11, 2015, and April 24, 2018. The dataset contains the daily price in US dollars, the market capitalization, and the trading volume of 1,681 cryptocurrencies, where the market capitalization is the product between price and circulating supply, and the volume is the number of coins exchanged in a day. The daily price is computed as the volume weighted average of all prices reported at each market. Figure 1 shows the number of currencies with trading volume larger than Vmin over time, for different values of Vmin. In the following sections, we consider that only currencies with daily trading volume higher than 105 USD (United States dollar) can be traded at any given day.Figure 1
Number of cryptocurrencies. The cryptocurrencies with volume higher than Vmin as a function of time, for different values of Vmin. For visualization purposes, curves are averaged over a rolling window of 10 days.The website lists cryptocurrencies traded on public exchange markets that have existed for more than 30 days and for which an API and a public URL showing the total mined supply are available. Information on the market capitalization of cryptocurrencies that are not traded in the 6 hours preceding the weekly release of data is not included on the website. Cryptocurrencies inactive for 7 days are not included in the list released. These measures imply that some cryptocurrencies can disappear from the list to reappear later on. In this case, we consider the price to be the same as before disappearing. However, this choice does not affect results since only in 28 cases the currency has volume higher than105 USD right before disappearing (note that there are 124,328 entries in the dataset with volume larger than 105 USD).


## 2.2. Metrics

Cryptocurrencies are characterized over time by several metrics, namely,(i)
Price, the exchange rate, determined by supply and demand dynamics.(ii)
Market capitalization, the product of the circulating supply and the price.(iii)
Market share, the market capitalization of a currency normalized by the total market capitalization.(iv)
Rank, therank of currency based on its market capitalization.(v)
Volume, coins traded in the last 24 hours.(vi)
Age, lifetime of the currency in days.The profitability of a currencyc over time can be quantified through thereturn on investment (ROI), measuring the return of an investment made at day ti relative to the cost [62]. The index i rolls across days and it is included between 0 and 895, with t0= November 11, 2015, and t895= April 24, 2018. Since we are interested in the short-term performance, we consider the return on investment after 1 day defined as(1)ROIc,ti=pricec,ti-pricec,ti-1pricec,ti-1.In Figure2, we show the evolution of the ROI over time for Bitcoin (orange line) and on average for currencies whose volume is larger than Vmin=105 USD at ti-1 (blue line). In both cases, the average return on investment over the period considered is larger than 0, reflecting the overall growth of the market.Figure 2
Return on investment over time. The daily return on investment for Bitcoin (orange line) and the average for currencies with volume larger than Vmin=105 USD (blue line). Their average value across time (dashed lines) is larger than 0. For visualization purposes, curves are averaged over a rolling window of 10 days.


## 2.3. Forecasting Algorithms

We test and compare three supervised methods for short-term price forecasting. The first two methods rely on XGBoost [63], an open-source scalable machine learning system for tree boosting used in a number of winning Kaggle solutions (17/29 in 2015) [64]. The third method is based on the long short-term memory (LSTM) algorithm for recurrent neural networks [56] that have demonstrated to achieve state-of-the-art results in time-series forecasting [65].Method 1. The first method considers one single regression model to describe the change in price of all currencies (see Figure 3). The model is an ensemble of regression trees built by the XGBoost algorithm. The features of the model are characteristics of a currency between time tj-w and tj-1 and the target is the ROI of the currency at time tj, where w is a parameter to be determined. The characteristics considered for each currency are price, market capitalization, market share, rank, volume, and ROI (see (1)). The features for the regression are built across the window between tj-w and tj-1 included (see Figure 3). Specifically, we consider the average, the standard deviation, the median, the last value, and the trend (e.g., the difference between last and first value) of the properties listed above. In the training phase, we include all currencies with volume larger than 105 USD and tj between ti-Wtraining and ti. In general, larger training windows do not necessarily lead to better results (see results section), because the market evolves across time. In the prediction phase, we test on the set of existing currencies at day ti. This procedure is repeated for values of ti included between January 1, 2016, and April 24, 2018.Figure 3
Schematic description of Method 1. The training set is composed of features and target (T) pairs, where features are various characteristics of a currency ci, computed across the w days preceding time tj and the target T is the price of ci at tj. The features-target pairs are computed for all currencies ci and all values of tj included between ti-Wtraining and ti-1. The test set includes features-target pairs for all currencies with trading volume larger than 105 USD at ti, where the target is the price at time ti and features are computed in the w days preceding ti.Method 2. Also the second method relies on XGBoost, but now the algorithm is used to build a different regression model for each currency ci (see Figure 4). The features of the model for currency ci are the characteristics of all the currencies in the dataset between tj-w and tj-1 included and the target is the ROI of ci at day tj (i.e., now the algorithm learns to predict the price of the currency i based on the features of all the currencies in the system between tj-w and tj-1). The features of the model are the same used in Method 1 (e.g., the average, standard, deviation, median, last value, and difference between last and first value of the following quantities: price, market capitalization, market share, rank, volume, and ROI) across a window of length w. The model for currency ci is trained with pairs features target between times ti-Wtraining and ti-1. The prediction set includes only one pair: the features (computed between ti-w and ti-1) and the target (computed at ti) of currency ci.Figure 4
Schematic description of Method 2. The training set is composed of features and target (T) pairs, where features are various characteristics of all currencies, computed across the w days preceding time tj and the target T is the price of ci at tj. The features-target pairs include a single currency ci, for all values of tj included between ti-Wtraining and ti-1. The test set contains a single features-target pair: the characteristics of all currencies, computed across the w days preceding time ti and the price of ci at ti.Method 3. The third method is based on long short-term memory networks, a special kind of recurrent neural networks, capable of learning long-term dependencies. As for Method 2, we build a different model for each currency. Each model predicts the ROI of a given currency at day ti based on the values of the ROI of the same currency between days ti-w and ti-1 included.Baseline Method. As baseline method, we adopt the simple moving average strategy (SMA) widely tested and used as a null model in stock market prediction [57–60]. It estimates the price of a currency at day ti as the average price of the same currency between ti-w and ti-1 included.


## 2.4. Evaluation

We compare the performance of various investment portfolios built based on the algorithms predictions. The investment portfolio is built at timeti-1 by equally splitting an initial capital among the top n currencies predicted with positive return. Hence, the total return at time ti is(2)Rti=1n∑c=1nROIc,ti.The portfolios performance is evaluated by computing the Sharpe ratio and the geometric mean return. The Sharpe ratio is defined as(3)Sti=R¯sR,where R¯ is the average return on investment obtained between times 0 and ti and sR is the corresponding standard deviation.The geometric mean return is defined as(4)Gti=∏tj=1ti1+RtjT,where ti corresponds to the total number of days considered. The cumulative return obtained at ti after investing and selling on the following day for the whole period is defined as G(ti)2.The number of currenciesn to include in a portfolio is chosen at ti by optimising either the geometric mean G(ti-1) (geometric mean optimisation) or the Sharpe ratio S(ti-1) (Sharpe ratio optimisation) over the possible choices of n. The same approach is used to choose the parameters of Method 1 (w and Wtraining), Method 2 (w and Wtraining), and the baseline method (w).


## 3. Results

We predict the price of the currencies at dayti, for all ti included between Jan 1, 2016, and Apr 24, 2018. The analysis considers all currencies whose age is larger than 50 days since their first appearance and whose volume is larger than $100000. To discount for the effect of the overall market movement (i.e., market growth, for most of the considered period), we consider cryptocurrencies prices expressed in BTC (Bitcoin). This implies that Bitcoin is excluded from our analysis.


### 3.1. Parameter Setting

First, we choose the parameters for each method. Parameters include the number of currenciesn to include the portfolio as well as the parameters specific to each method. In most cases, at each day ti we choose the parameters that maximise either the geometric mean G(ti-1) (geometric mean optimisation) or the Sharpe ratio S(ti-1) (Sharpe ratio optimisation) computed between times 0 and ti.Baseline Strategy. We test the performance of the baseline strategy for choices of window w≥2 (the minimal requirement for the ROI to be different from 0) and w<30. We find that the value of w mazimising the geometric mean return (see Appendix Section A) and the Sharpe ratio (see Appendix Section A) fluctuates especially before November 2016 and has median value 4 in both cases. The number of currencies included in the portfolio oscillates between 1 and 11 with median at 3, both for the Sharpe ratio (see Appendix Section A) and the geometric mean return (see Appendix Section A) optimisation.Method 1. We explore values of the window w in {3,5,7,10} days and the training period Wtraining in {5,10,20} days (see Appendix Section A). We find that the median value of the selected window w across time is 7 for both the Sharpe ratio and the geometric mean optimisation. The median value of Wtraining is 5 under geometric mean optimisation and 10 under Sharpe ratio optimisation. The number of currencies included in the portfolio oscillates between 1 and 43 with median at 15 for the Sharpe ratio (see Appendix Section A) and 9 for the geometric mean return (see Appendix Section A) optimisation.Method 2. We explore values of the window w in {3,5,7,10} days and the training period Wtraining in {5,10,20} days (see Appendix, Figure 10). The median value of the selected window w across time is 3 for both the Sharpe ratio and the geometric mean optimisation. The median value of Wtraining is 10 under geometric mean and Sharpe ratio optimisation. The number of currencies included has median at 17 for the Sharpe ratio and 7 for the geometric mean optimisation (see Appendix Section A).Method 3. The LSTM has three parameters: The number of epochs, or complete passes through the dataset during the training phase; the number of neurons in the neural network, and the length of the window w. These parameters are chosen by optimising the price prediction of three currencies (Bitcoin, Ripple, and Ethereum) that have on average the largest market share across time (excluding Bitcoin Cash that is a fork of Bitcoin). Results (see Appendix Section A) reveal that, in the range of parameters explored, the best results are achieved for w=50. Results are not particularly affected by the choice of the number of neurones nor the number of epochs. We choose 1 neuron and 1000 epochs since the larger these two parameters, the larger the computational time. The number of currencies to include in the portfolio is optimised over time by mazimising the geometric mean return (see Appendix Section A) and the Sharpe ratio (see Appendix Section A). In both cases the median number of currencies included is 1.


### 3.2. Cumulative Return

In Figure5, we show the cumulative return obtained using the 4 methods. The cumulative returns achieved on April 24 under the Sharpe ratio optimisation are ~65 BTC (Baseline), ~1.1·103 BTC (Method 1), ~95 BTC (Method 2), ~1.2·109 BTC (Method 3). Under geometric mean optimisation we obtain ~25 BTC (Baseline), ~19·103 BTC (Method 1), ~1.25 BTC (Method 2), ~3.6·108 BTC (Method 3). The cumulative returns obtained in USD are higher (see Appendix Section D). This is expected, since the Bitcoin price has increased during the period considered. While some of these figures appear exaggerated, it is worth noticing that (i) we run a theoretical exercise assuming that the availability of Bitcoin is not limited and (ii) under this assumption the upper bound to our strategy, corresponding to investing every day in the most performing currency results in a total cumulative return of 6·10123 BTC (see Appendix Section B). We consider also the more realistic scenario of investors paying a transaction fee when selling and buying currencies (see Appendix Section C). In most exchange markets, the fee is typically included between 0.1% and 0.5% of the traded amount [66]. For fees up to 0.2%, all the investment methods presented above lead, on average, to positive returns over the entire period (see Appendix Section C). The best performing method, Method 3, achieves positive gains also when fees up to 1% are considered (see Appendix Section C).Figure 5
Cumulative returns. The cumulative returns obtained under the Sharpe ratio optimisation (a) and the geometric mean optimisation (b) for the baseline (blue line), Method 1 (orange line), Method 2 (green line), and Method 3 (red line). Analyses are performed considering prices in BTC.
(a) (b)The cumulative return in Figure5 is obtained by investing between January 1st, 2016 and April 24th, 2018. We investigate the overall performance of the various methods by looking at the geometric mean return obtained in different periods (see Figure 6). Results presented in Figure 6 are obtained under Sharpe ratio optimisation for the baseline (Figure 6(a)), Method 1 (Figure 6(b)), Method 2 (Figure 6(c)), and Method 3 (Figure 6(d)). Note that, while in this case the investment can start after January 1, 2016, we optimised the parameters by using data from that date on in all cases. Results are considerably better than those achieved using geometric mean return optimisation (see Appendix Section E). Finally, we observe that better performance is achieved when the algorithms consider prices in Bitcoin rather than USD (see Appendix Section D).Figure 6
Geometric mean return obtained within different periods of time. The geometric mean return computed between time “start" and “end" using the Sharpe ratio optimisation for the baseline (a), Method 1 (b), Method 2 (c), and Method 3 (d). Note that, for visualization purposes, the figure shows the translated geometric mean return G-1. Shades of red refer to negative returns and shades of blue to positive ones (see colour bar).


### 3.3. Feature Importance

In Figure7, we illustrate the relative importance of the various features in Method 1 and Method 2. For Method 1, we show the average feature importance. For Method 2, we show the average feature importance for two sample currencies: Ethereum and Ripple.Figure 7
Feature importance for Methods 1 and 2. (a) The average importance of each feature for the XGBoost regression model of Method 1. Results are shown for w=7 and Wtraining=10. (b, c) Examples of average feature importance for the XGBoost regression model developed in Method 2. Results are shown for w=3, Wtraining=10, for Ethereum (b) and Ripple (c). For visualization purposes, we show only the top features.


### 3.4. Portfolio Composition

The 10 most selected currencies under Sharpe ratio optimisation are the following:Baseline. Factom (91 days), E-Dinar Coin (89 days), Ripple (76 days), Ethereum (71 days), Steem (70 days), Lisk (70 days), MaidSafeCoin (69 days), Monero (58 days), BitShares (55 days), EDRCoin (52 days).Method 1. Ethereum (154 days), Dash (128 days), Monero (111 days), Factom (104 days), Ripple (94 days), Litecoin (93 days), Dogecoin (92 days), Maid Safe Coin (86 days), BitShares (73 days), Tether (59 days)Method 2. Ethereum (63 days), Monero (61 days), Factom (51 days), Ripple (42 days), Dash (40 days), Maid Safe Coin (40 days), Siacoin (30 days), NEM (26 days), NXT (26 days), Steem (23 days).Method 3. Factom (48 days), Monero (46 days), Ethereum (39 days), Lisk (36 days), Maid Safe Coin (32 days), E-Dinar Coin (32 days), BitShares (26 days), B3 Coin (26 days), Dash (25 days), Cryptonite (22 days).


## 3.1. Parameter Setting

First, we choose the parameters for each method. Parameters include the number of currenciesn to include the portfolio as well as the parameters specific to each method. In most cases, at each day ti we choose the parameters that maximise either the geometric mean G(ti-1) (geometric mean optimisation) or the Sharpe ratio S(ti-1) (Sharpe ratio optimisation) computed between times 0 and ti.Baseline Strategy. We test the performance of the baseline strategy for choices of window w≥2 (the minimal requirement for the ROI to be different from 0) and w<30. We find that the value of w mazimising the geometric mean return (see Appendix Section A) and the Sharpe ratio (see Appendix Section A) fluctuates especially before November 2016 and has median value 4 in both cases. The number of currencies included in the portfolio oscillates between 1 and 11 with median at 3, both for the Sharpe ratio (see Appendix Section A) and the geometric mean return (see Appendix Section A) optimisation.Method 1. We explore values of the window w in {3,5,7,10} days and the training period Wtraining in {5,10,20} days (see Appendix Section A). We find that the median value of the selected window w across time is 7 for both the Sharpe ratio and the geometric mean optimisation. The median value of Wtraining is 5 under geometric mean optimisation and 10 under Sharpe ratio optimisation. The number of currencies included in the portfolio oscillates between 1 and 43 with median at 15 for the Sharpe ratio (see Appendix Section A) and 9 for the geometric mean return (see Appendix Section A) optimisation.Method 2. We explore values of the window w in {3,5,7,10} days and the training period Wtraining in {5,10,20} days (see Appendix, Figure 10). The median value of the selected window w across time is 3 for both the Sharpe ratio and the geometric mean optimisation. The median value of Wtraining is 10 under geometric mean and Sharpe ratio optimisation. The number of currencies included has median at 17 for the Sharpe ratio and 7 for the geometric mean optimisation (see Appendix Section A).Method 3. The LSTM has three parameters: The number of epochs, or complete passes through the dataset during the training phase; the number of neurons in the neural network, and the length of the window w. These parameters are chosen by optimising the price prediction of three currencies (Bitcoin, Ripple, and Ethereum) that have on average the largest market share across time (excluding Bitcoin Cash that is a fork of Bitcoin). Results (see Appendix Section A) reveal that, in the range of parameters explored, the best results are achieved for w=50. Results are not particularly affected by the choice of the number of neurones nor the number of epochs. We choose 1 neuron and 1000 epochs since the larger these two parameters, the larger the computational time. The number of currencies to include in the portfolio is optimised over time by mazimising the geometric mean return (see Appendix Section A) and the Sharpe ratio (see Appendix Section A). In both cases the median number of currencies included is 1.


## 3.2. Cumulative Return

In Figure5, we show the cumulative return obtained using the 4 methods. The cumulative returns achieved on April 24 under the Sharpe ratio optimisation are ~65 BTC (Baseline), ~1.1·103 BTC (Method 1), ~95 BTC (Method 2), ~1.2·109 BTC (Method 3). Under geometric mean optimisation we obtain ~25 BTC (Baseline), ~19·103 BTC (Method 1), ~1.25 BTC (Method 2), ~3.6·108 BTC (Method 3). The cumulative returns obtained in USD are higher (see Appendix Section D). This is expected, since the Bitcoin price has increased during the period considered. While some of these figures appear exaggerated, it is worth noticing that (i) we run a theoretical exercise assuming that the availability of Bitcoin is not limited and (ii) under this assumption the upper bound to our strategy, corresponding to investing every day in the most performing currency results in a total cumulative return of 6·10123 BTC (see Appendix Section B). We consider also the more realistic scenario of investors paying a transaction fee when selling and buying currencies (see Appendix Section C). In most exchange markets, the fee is typically included between 0.1% and 0.5% of the traded amount [66]. For fees up to 0.2%, all the investment methods presented above lead, on average, to positive returns over the entire period (see Appendix Section C). The best performing method, Method 3, achieves positive gains also when fees up to 1% are considered (see Appendix Section C).Figure 5
Cumulative returns. The cumulative returns obtained under the Sharpe ratio optimisation (a) and the geometric mean optimisation (b) for the baseline (blue line), Method 1 (orange line), Method 2 (green line), and Method 3 (red line). Analyses are performed considering prices in BTC.
(a) (b)The cumulative return in Figure5 is obtained by investing between January 1st, 2016 and April 24th, 2018. We investigate the overall performance of the various methods by looking at the geometric mean return obtained in different periods (see Figure 6). Results presented in Figure 6 are obtained under Sharpe ratio optimisation for the baseline (Figure 6(a)), Method 1 (Figure 6(b)), Method 2 (Figure 6(c)), and Method 3 (Figure 6(d)). Note that, while in this case the investment can start after January 1, 2016, we optimised the parameters by using data from that date on in all cases. Results are considerably better than those achieved using geometric mean return optimisation (see Appendix Section E). Finally, we observe that better performance is achieved when the algorithms consider prices in Bitcoin rather than USD (see Appendix Section D).Figure 6
Geometric mean return obtained within different periods of time. The geometric mean return computed between time “start" and “end" using the Sharpe ratio optimisation for the baseline (a), Method 1 (b), Method 2 (c), and Method 3 (d). Note that, for visualization purposes, the figure shows the translated geometric mean return G-1. Shades of red refer to negative returns and shades of blue to positive ones (see colour bar).


## 3.3. Feature Importance

In Figure7, we illustrate the relative importance of the various features in Method 1 and Method 2. For Method 1, we show the average feature importance. For Method 2, we show the average feature importance for two sample currencies: Ethereum and Ripple.Figure 7
Feature importance for Methods 1 and 2. (a) The average importance of each feature for the XGBoost regression model of Method 1. Results are shown for w=7 and Wtraining=10. (b, c) Examples of average feature importance for the XGBoost regression model developed in Method 2. Results are shown for w=3, Wtraining=10, for Ethereum (b) and Ripple (c). For visualization purposes, we show only the top features.


## 3.4. Portfolio Composition

The 10 most selected currencies under Sharpe ratio optimisation are the following:Baseline. Factom (91 days), E-Dinar Coin (89 days), Ripple (76 days), Ethereum (71 days), Steem (70 days), Lisk (70 days), MaidSafeCoin (69 days), Monero (58 days), BitShares (55 days), EDRCoin (52 days).Method 1. Ethereum (154 days), Dash (128 days), Monero (111 days), Factom (104 days), Ripple (94 days), Litecoin (93 days), Dogecoin (92 days), Maid Safe Coin (86 days), BitShares (73 days), Tether (59 days)Method 2. Ethereum (63 days), Monero (61 days), Factom (51 days), Ripple (42 days), Dash (40 days), Maid Safe Coin (40 days), Siacoin (30 days), NEM (26 days), NXT (26 days), Steem (23 days).Method 3. Factom (48 days), Monero (46 days), Ethereum (39 days), Lisk (36 days), Maid Safe Coin (32 days), E-Dinar Coin (32 days), BitShares (26 days), B3 Coin (26 days), Dash (25 days), Cryptonite (22 days).


## 4. Conclusion

We tested the performance of three forecasting models on daily cryptocurrency prices for1,681 currencies. Two of them (Method 1 and Method 2) were based on gradient boosting decision trees and one is based on long short-term memory recurrent neural networks (Method 3). In Method 1, the same model was used to predict the return on investment of all currencies; in Method 2, we built a different model for each currency that uses information on the behaviour of the whole market to make a prediction on that single currency; in Method 3, we used a different model for each currency, where the prediction is based on previous prices of the currency.We built investment portfolios based on the predictions of the different method and compared their performance with that of a baseline represented by the well-known simple moving average strategy. The parameters of each model were optimised for all but Method 3 on a daily basis, based on the outcome of each parameters choice in previous times. We used two evaluation metrics used for parameter optimisation: The geometric mean return and the Sharpe ratio. To discount the effect of the overall market growth, cryptocurrencies prices were expressed in Bitcoin. All strategies produced profit (expressed in Bitcoin) over the entire considered period and for a large set of shorter trading periods (different combinations of start and end dates for the trading activity), also when transaction fees up to0.2% are considered.The three methods performed better than the baseline strategy when the investment strategy was ran over the whole period considered. The optimisation of parameters based on the Sharpe ratio achieved larger returns. Methods based on gradient boosting decision trees (Methods 1 and 2) worked best when predictions were based on short-term windows of 5/10 days, suggesting they exploit well mostly short-term dependencies. Instead, LSTM recurrent neural networks worked best when predictions were based on~50 days of data, since they are able to capture also long-term dependencies and are very stable against price volatility. They allowed making profit also if transaction fees up to 1% are considered. Methods based on gradient boosting decision trees allow better interpreting results. We found that the prices and the returns of a currency in the last few days preceding the prediction were leading factors to anticipate its behaviour. Among the two methods based on random forests, the one considering a different model for each currency performed best (Method 2). Finally, it is worth noting that the three methods proposed perform better when predictions are based on prices in Bitcoin rather than prices in USD. This suggests that forecasting simultaneously the overall cryptocurrency market trend and the developments of individual currencies is more challenging than forecasting the latter alone.It is important to stress that our study has limitations. First, we did not attempt to exploit the existence of different prices on different exchanges, the consideration of which could open the way to significantly higher returns on investment. Second, we ignored intraday price fluctuations and considered an average daily price. Finally, and crucially, we run a theoretical test in which the available supply of Bitcoin is unlimited and none of our trades influence the market. Notwithstanding these simplifying assumptions, the methods we presented were systematically and consistently able to identify outperforming currencies. Extending the current analysis by considering these and other elements of the market is a direction for future work.A different yet promising approach to the study cryptocurrencies consists in quantifying the impact of public opinion, as measured through social media traces, on the market behaviour, in the same spirit in which this was done for the stock market [67]. While it was shown that social media traces can be also effective predictors of Bitcoin [68–74] and other currencies [75] price fluctuations, our knowledge of their effects on the whole cryptocurrency market remain limited and is an interesting direction for future work.



---

*Source: 8983590-2018-11-04.xml*