Skip to content
Eugenio Menacho de Góngora edited this page May 22, 2022 · 1 revision

LSTM model to predict Cardano cryptocurrency values

How does it work?

In this case, we are trying to predict what is going to be the high value for the next time frame. In order to do this, we take a dataset using the Binance API we scrap it and then train our model to make the predictions.

Code

First, we read the dataset:

image

The dataset looks like this:

image

We drop the unnecessary columns and change the dataset to numeric:

image

The dataset looks like this:

image

Get the Y and scale the values:

image

We build the train and test values for the model, in this case the latest 200 rows will be the test. We also prepare the X values for the LSTM model, we take groups of two.

image

Define and train the model:

image

Results

Get predictions and plot them:

image

Plot:

Predicciones

Get the loss of the model and plot the train and test loss:

loss

Conclusions

As we can see, the model fits correctly as the train and test loss goes down. The problem becomes later because we can fit more or less the next high values, but predicting them is like predicting the lottery, it is almost impossible. So in conclusion, you can fit a model precisely to predict the next high value, but the results will almost never be precise enough to be useful in market predictions.

Clone this wiki locally