Skip to content

In this project, I will use tools such as Deep Learning by incorporating sentiment from social media and news articles to help guide trading predictions.

Notifications You must be signed in to change notification settings

jharvey09/A_Look_Into_The_Future_With_LSTM

Repository files navigation

A Look Into The Future With LSTM

pexels-tara-winstead-8386440 Photo by Tara Winstead from Pexels

In this assignment, I will use tools such as deep learning recurrent neural networks to model bitcoin's closing prices. One model will use the FNG indicators to predict the closing price, and the second model will use a window of closing prices to predict the nth closing price. One example is the Crypto Fear & Greed Index (FNG)

Table of Contents:

Preparing The Data

Build and Train LSTM RNN

Model Performance

Fear and Greed Predictior

Conclusion

Preparing The Data: (Closing Predictor)

  1. Set the random seed for reproducibility
  2. Load "Greed and Fear" sentiment data for Bitcoin

image

  1. Load historical data closing prices for Bitcoin

image

  1. Join data to a single DataFrame

image - tail

image - head

  1. Predict Closing Prices using a window size 10 of previous closing prices. For different performance changes, use numbers from 1 - 10. For this model, I chose to use a window size of 7.
  2. Use 70% of the data for training and the remaining for testing.
  3. Use MinMaxScaler to scale data between 0 and 1
  4. Reshape the features for the model

Build and Train the LSTM RNN:

  1. Build the LSTM model, if adding additional LSTM layers, set return sequences to True. But not neccessary for final layer
  2. Compile the model
  3. Summarize the model

image

  1. Train the model

image

Model Performance:

1.Evaluate the model using the X_test and the y_test data

image

  1. Create a DataFrame of Real and Predicited values

image

  1. Plot the real versus predicted value in a line chart

image

Fear and Greed Predictor:

  1. Follow same steps above (Prepare Data, Build and Train the LSTM model, Model performence)
  2. summarize model, for this model I used a window size of 9

image

image

image

  1. Create DataFrame of Real and Predicited values

image

  1. Plot the real versus the predicited values as a line chart

image

Conclusion:

In preparation for these models, I arrived at three questions that would make the cohesive connection between data, predictions. First thing I asked myself was, "Which model would have the lowest loss?" Next, I compiled the information to see, "Which model tracks the actual values better over time?" I had to think the best way to figure this out was to know, "Which window size works the best for the model?"

After comparing both models (Fear and Greed Index, Closing Prices) using a 10-day window, It would be concise in pointing out that the Closing Prices model would appear to be the better model. Closing Prices Loss: 0.0540 | Fear & Greed Index Loss: 0.1256

Elapsed Tracking Data:

The model based on closing prices had appeared to track the "true" values better than the model based on the Fear and Greed Index. After comparing the charts for the two models displaying Real vs. Predicted values, over the elapsed time, the predictions based on the Closing Prices model reflected more of a "true" value than the model based on the Fear and Greed Index. Using a smaller window size on both models gave better predictions, but the "Closing Price" model was the closest to real or "true" value.

About

In this project, I will use tools such as Deep Learning by incorporating sentiment from social media and news articles to help guide trading predictions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published