Don’t be fooled — Deceptive Cryptocurrency Price Predictions

Why you should be cautious with neural networks for trading

So I built a Deep Neural Network to predict the price of Bitcoin — and it’s astonishingly accurate.

Curious?

See the prediction results for yourself.

Looks pretty accurate, doesn’t it?

And before you ask: Yes, the above evaluation was performed on unseen test data — only prior data was used to train the model (more details later).

So this is a money-making machine I can use to get rich!

Right?

In fact, I am giving you the code for the above model so that you can use it yourself…

OK, STOP RIGHT THERE. DON’T DO IT.

I repeat: Don’t do it! Do not use it for trading.

Don’t be fooled.

There is something utterly deceptive about these results.

Let me explain.

Too Good to be True

During the last couple of weeks and months I’ve encountered many articles that take a similar approach to the one presented here and that show graphs of cryptocurrency price predictions that look like the one above.

The seemingly stunning accuracy of price predictions should immediately set off alarm bells.

These results are obviously too good to be true.

When something looks too good to be true, it usually is.
Emmy Rossum

In the following, I want to demonstrate why this is the case.

Don’t get me wrong — my intention is not to undermine the work put into those articles. They are good and deserve the claps they received. In fact, many of those approaches are very accurate — technically speaking.

The goal of this article is to bring out why those models are, in practice, fallacious and why their predictions are not necessarily suitable for usage in actual trading.

So why exactly is this the case? Let’s take a close look.

Predicting the Price of Bitcoin using LSTMs

To explain, let me walk you through an example of building a multidimensional Long Short Term Memory (LSTM) neural network to predict the price of Bitcoin that yields the prediction results you saw above.

LSTMs are a special kind of Recurrent Neural Networks (RNN), that are particularly suitable for time series problems. Hence, they have become popular when trying to forecast cryptocurrency prices, as well as stock markets.

For in-depth introductions to LSTMs I recommend this and this article.

For the present implementation of the LSTM, I used Python and Keras. (You can find the corresponding Jupyter Notebook with the complete code on my Github.)

1. Getting the Data

First, I fetched historic Bitcoin price data (you can do this for any other cryptocurrency as well). To do so I used the API from cryptocompare:

Voilà, historic daily BTC data for the last 2000 days, from 2012–10–10 until 2018–04–04.

2. Train-Test Split

Then, I split the data into a training and a test set. I used the last 10% of the data for testing, which splits the data on the 2017–09–14. All data before this date was used for training, all data from this date on was used to test the trained model. Below, I plotted the close column of our DataFrame, which is the daily closing price I intended to predict.

3. Building the Model

For training the LSTM, the data was split into windows of 7 days (this number is arbitrary, I simply chose a week here) and within each window I normalised the data to zero base, i.e. the first entry of each window is 0 and all other values represent the change with respect to the first value. Hence, I am predicting price changes, rather than absolute price.

I used a simple neural network with a single LSTM layer consisting of 20 neurons, a dropout factor of 0.25, and a Dense layer with a single linear activation function. In addition, I used Mean Absolute Error (MAE) as loss function and the Adam optimiser.

I trained the network for 50 epochs with a batch size of 4.

Note: The choice of the network architecture and all parameters is arbitrary and I didn’t optimise for any them, as this is not the focus of this article.

You may also like