# Algorithms for calculating cryptocurrency prices

Output length of hashing algorithm must be fixed (a good value is Calculating the HASH value should not be compute intensive and should be fast. Tier 2 (Application) – In the application layer, the sentiment score of each pre- processed tweet was calculated using VADER algorithm and. of prices of BitCoin (BTC), one of the most popular crypto-currencies in the tracting the best features and finding a mathematical representation that. CRYPTO MINING HIJACKER

## Commit error. final number of bitcoins pity, that

### CRYPTOCURRENCY 5 YEAR PREDICTIONS

Autocorrelation is the correlation of data points separated by some interval known as lag. A time series is said to be stationarity if it has constant mean and variance. Also, the covariance is independent of the time. Time Series forecasting. There are many approaches that you can use for this purpose. RNNs allow using the output from the model as a new input for the same model.

The process can be repeated indefinitely. One serious limitation of RNNs is the inability of capturing long-term dependencies in a sequence e. The default LSTM behavior is remembering information for prolonged periods of time. Recall that this will help our optimization algorithm converge faster:. The scaler expects the data to be shaped as x, y , so we add a dummy dimension using reshape before applying it.

We use isnan as a mask to filter out NaN values. Again we reshape the data after removing the NaNs. LSTMs expect the data to be in 3 dimensions. We need to split the data into sequences of some preset length. The shape we want to obtain is:. The process of building sequences works by creating a sequence of a specified length at position 0.

Then we shift one position to the right e. The process is repeated until all possible positions are used. Our model will use sequences representing 99 days of Bitcoin price changes each for training. Bidirectional RNNs allows you to train on the sequence data in forward and backward reversed direction. In practice, this approach works well with LSTMs. Personally, I think it is a good example of leaky abstraction, but it is crazy fast!

Our output layer has a single neuron predicted Bitcoin price. We use Linear activation function which activation is proportional to the input. After a lightning-fast training thanks Google for the free T4 GPUs , we have the following training loss:. We can use our scaler to invert the transformation we did so the prices are no longer scaled in the [0, 1] range. The predictability of the models in the validation and test sub-samples is assessed via several metrics. Basically, a long position in the market is created if at least four, five, or six individual models out of the six models agree on the positive trading signal for the next day.

If the threshold number of forecasts in agreement is not met for the next day, the trader does not enter into the market or the existing positive position is closed, and the trader gets out of the market. Notice that the trading strategies only consider the creation of long positions, because short selling in the market of cryptocurrencies may be difficult or even impossible.

Model averaging or assembling of basic ML models are quite simple classifier procedures; other more complex classification procedures presented in the literature could be used in this framework, with a high probability of producing better results.

For instance, Kou et al. Kou et al. Li et al. The assessment of the profitability of the trading strategies is conducted using a battery of performance indicators. The win rate is equal to the ratio between the number of days when the ensemble model gives the right positive sign for the next day and the total of the days in the market. The mean and standard deviation of the returns when the positions are active are also shown.

The annual return is the compound return per year given by the accumulated discrete daily returns considering all days in the test sample, including zero-return days when the strategies prescribe not being in the market. The latter measures the maximum observed loss from a peak to a trough of the accumulated value of the trading strategy, before a new peak is attained, relative to the value of that peak. We also present the annual return after considering transaction costs. As highlighted by Alessandretti et al.

Thus, even if the investor trades in a high-fee online exchange, it seems that a proportional round-trip transaction cost of 0. This is a higher figure than is used in most of the related literature. Table 5 shows the sets of variables that maximize the average return of a trading strategy in the validation period—without any trading costs or liquidity constraints—devised upon the trading positions obtained from rolling-window, one-step forecasts.

These sets are kept constant and then used in the test sample. Several patterns emerge from this table. First, all models use the lag returns of the three cryptocurrencies, the lagged volatility proxies, and the day-of-the-week dummies. Second, in most cases, the lag structure is the same for those variables for which more than one lag is allowed, that is, for returns and Parkinson range volatility estimator.

Third, the other trading variables i. Table 6 presents the metrics on the forecasting ability of the regression models and the success rate for the binary versions of the linear, RF, and SVM models classification. In the validation sub-sample, the success rates of the classification models range from Meanwhile, the success rates for the regression models range from During the validation period, the classification models produce, on average for the three cryptocurrencies, a success rate of In the validation sample, the MAEs range from 4.

In the test sub-sample, the success rates of the classification models range from During the test period, the classification models produce, on average for the three cryptocurrencies, a success rate of In the test sample, the MAEs range from 2. Assembling the individual models also has an additional positive impact on the profitability of the trading strategies after trading costs, because it prescribes no trading when there is no strong trading signal; hence, reducing the number of trades and providing savings in trading costs.

Table 7 presents the statistics on the performance of these trading strategies based on model assembling. The average profit per day in the market is negative only for Ensemble 4 for bitcoin; but in some other cases, it is quite low, not reaching 0. The annual returns are higher for Ensemble 5, as applied to ethereum and litecoin, achieving the values of These two strategies have impressive annualized Sharpe ratios of Ethereum stands out as the most profitable cryptocurrency, according to the annual returns of Ensembles 5 and 6, with and without consideration of trading costs.

A possible explanation for this result is that ethereum is the most predictable cryptocurrency in the set, especially if those predictions are based not only on information concerning ethereum but also on information concerning other cryptocurrencies. Most studies that include in their sample the three cryptocurrencies examined here suggest that bitcoin is the leading market in terms of information transmission; however, some studies emphasize the efficiency of litecoin.

For instance, Ji et al. Naturally, the performance of the strategies worsens when trading costs are considered. With a proportional round-trip trading cost of 0. However, most notably, the consideration of these trading costs highlights what is already visible from the other statistics, namely, that the best strategies are Ensemble 5 applied to ethereum and litecoin.

This study examines the predictability of three major cryptocurrencies: bitcoin, ethereum, and litecoin, and the profitability of trading strategies devised upon ML, namely linear models, RF, and SVMs. The classification and regression methods use attributes from trading and network activity for the period from August 15, to March 03, , with the test sample beginning at April 13, For each model class, the set of variables that leads to the best performance is chosen according to the average return per trade during the validation sample.

These returns result from a trading strategy that uses the sign of the return forecast in the case of regression models or the binary prediction of an increase or decrease in the price in the case of classification models , obtained in a rolling-window framework, to devise a position in the market for the next day.

Although there are already some ML applications to the market of cryptocurrencies, this work has some aspects that researchers and market practitioners might find informative. Specifically, it covers a more recent timespan featuring the market turmoil since mid and the bear market situation afterward; it uses not only trading variables but also network variables as important inputs to the information set; and it provides a thorough statistical and economic analysis of the scrutinized trading strategies in the cryptocurrencies market.

Most notably, it should be emphasized that the prices in the validation period experience an explosive behavior, followed by a sudden and meaningful drop; nevertheless, the mean return is still positive. Meanwhile in the test sample, the prices are more stable, but the mean return is negative. Hence, analyzing the performance of trading strategies within this harsh framework may be viewed as a robustness test on their profitability.

The forecasting accuracy is quite different across models and cryptocurrencies, and there is no discernible pattern that allows us to conclude on which model is superior or which is the most predictable cryptocurrency in the validation or test periods.

However, generally, the forecasting accuracy of the individual models seems low when compared with other similar studies. This is not surprising because the best in-class model is not built on the minimization of the forecasting error but on the maximization of the average of the one-step-ahead returns. The main visible pattern is that the forecasting accuracy in the validation sub-sample is lower than in test sub-sample, which is most probably related to the significant differences in the price trends experienced in the former period.

Taking into account the relatively low forecasting performance of the individual models in the validation sample, and the results already reported in the literature that model assembling gives the best outcomes, the analysis of profitability in the cryptocurrencies market is conducted considering trading strategies in accordance with the rules that a long position in the market is created if at least four, five, or six individual models agree on the positive trading sign for the next day.

The trading strategies only consider the creation of long positions, given that short selling in the market of cryptocurrencies may be difficult or even impossible. Generally, these strategies are able to significantly beat the market.

Basically, the results point out that the best trading strategies are Ensemble 5 applied to ethereum and litecoin, which achieved an annualized Sharpe ratio of These values seem low when compared with the daily minima and maxima returns of these cryptocurrencies during the test sub-sample. However, one may argue that the fact that they are positive may support the belief that ML techniques have potential in the cryptocurrencies market, that is, when prices are falling down, and the probability of extreme negative events is high, the trading strategy still presents a positive return after trading costs, which may indicate that these strategies may hold even in quite adverse market conditions.

It is noteworthy that in ML applications there are many decisions to be made concerning the best methods, data partitioning, parameter setting, attribute space, and so on. In this study, the main goal is not to test extensively the alternative forecasting and trading strategies; hence, there is no guarantee that we are using the best methods available. Instead, our aim is more modest, as we simply try to figure out if ML can, in general, lead to profitable strategies in the cryptocurrency market and if this profitability still exists when market conditions are changing and more realistic market features are considered.

Higher frequency data, for instance using real transaction prices from a particular online exchange; a wider input set including more refined attributes such as technical analysis indicators; the consideration of bitcoin futures, where short positions are easily created and transaction costs are lower—all these arguably may lead to better results. Finance Res Lett — Article Google Scholar. Complexity Google Scholar.

Eur J Oper Res 2 — Bariviera AF The inefficiency of bitcoin revisited: a dynamic approach. Econ Lett —4. Sci Ann Econ Bus 65 2 — A quantiles-based approach. Econ Model — In: Data mining techniques for the life sciences. Humana Press, London, pp — Borges TA, Neves RF Ensemble of machine learning algorithms for cryptocurrency investment with different data resampling methods. Appl Soft Comput Ann Econ Finance 16 2 — Mathematical and statistical methods for actuarial sciences and finance.

Springer, Cham, pp — Chapter Google Scholar. Int J Forecast 35 2 — Charfeddine L, Mauchi Y Are shocks on the returns and volatility of cryptocurrencies really persistent? An empirical investigation into the fundamental value of Bitcoin. Econ Lett — Emerg Mark Finance Trade 56 10 — Chen Z, Li C, Sun W b Bitcoin price prediction using machine learning: an approach to sample dimension engineering.

J Comput Appl Math Gox Bitcoin prices. Appl Econ 47 23 — Res Int Bus Finance Appl Econ 48 19 — J Finance Data Sci 5 2 — Dorfleitner G, Lung C Cryptocurrencies from the perspective of euro investors: a re-examination of diversification benefits and a new day-of-the-week effect. J Asset Manag 19 7 — Dwyer GP The economics of Bitcoin and similar private digital currencies. J Financ Stab — Preprint arXiv Rev Financ Stud 32 5 — Gkillas K, Katsiampa P An application of extreme value theory to cryptocurrencies.

J Behav Exp Finance Comput Econ. J Finance Data Sci 5 3 — J Risk Financ Manag 12 3 Jang H, Lee J An empirical study on modeling and prediction of Bitcoin prices with Bayesian neural networks based on blockchain information. IEEE Access — Int Rev Financ Anal — Mathematics 7 10 Jiang Z, Liang J Cryptocurrency portfolio management with deep reinforcement learning.

In: intelligent systems conference intelliSys. Inf Sci — Koutmos D Return and volatility spillovers among cryptocurrencies. Kristoufek L BitCoin meets Google trends and wikipedia: quantifying the relationship between phenomena of the Internet era. Sci Rep. Kristoufek L What are the main drivers of the bitcoin price?

Evidence from wavelet coherence analysis. Lahmiri S, Bekiros S Cryptocurrency forecasting with deep learning chaotic neural networks. Chaos Solitons Fractals — Decis Support Syst — Inf Syst R News 2 3 — Mallqui DC, Fernandes RA Predicting the direction, maximum, minimum and closing prices of daily Bitcoin exchange rate using machine learning techniques.

Appl Soft Comput — R package version 1. Economics Letters —9. Nakamoto S Bitcoin: a peer-to-peer electronic cash system. Phys A — In: 26th Euromicro international conference on parallel, distributed and network-based processing PDP. Res Int Bus Finance — Panagiotidis T, Stengos T, Vravosinos O The effects of markets, uncertainty and search intensity on bitcoin returns.

Parkinson M The extreme value method for estimating the variance of the rate of return. J Bus 53 1 — Patel J, Shah S, Thakkar P, Kotecha K Predicting stock and stock price index movement using trend deterministic data preparation and machine learning techniques. Expert Syst Appl — Phillips R C, Gorse D Predicting cryptocurrency price bubbles using social media data and epidemic modelling.

Int J Electron Commerce 20 1 :9— J Am Stat Assoc 89 — Econ Rev 23 1 — Finance Res Lett. Notas Econ — Shintate T, Pichl L Trend prediction classification for high frequency bitcoin time series with deep learning. J Risk Financ Manag 12 1 Stat Comput 14 3 — Smuts N What drives cryptocurrency prices? An investigation of google trends and telegram sentiment. J Econ Financ Anal 2 2 :1— J Behav Exp Finance — Finance Res Lett Omega — Torgo L Data mining with R: learning with case studies.

CRC Press, London. Book Google Scholar. Urquhart A The inefficiency of Bitcoin. J Comput Inf Syst. Int Rev Financ Anal Yermack D Is bitcoin a real currency? An economic appraisal. In: Handbook of digital currency. Academic Press, London, pp 31— In: Handbook of natural computing. Springer, Berlin, pp — In: Machine intelligence and big data in industry. J Risk Financ Manag 13 1 Financ Innov 3 1 Download references. Dias da Silva, , , Coimbra, Portugal.

You can also search for this author in PubMed Google Scholar. Both authors were involved in all the research that led to the article and in its writing. Both authors read and approved the final manuscript. Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. Reprints and Permissions. Forecasting and trading cryptocurrencies with machine learning under changing market conditions.