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)
- Set the random seed for reproducibility
- Load "Greed and Fear" sentiment data for Bitcoin
- Load historical data closing prices for Bitcoin
- Join data to a single DataFrame
- 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.
- Use 70% of the data for training and the remaining for testing.
- Use MinMaxScaler to scale data between 0 and 1
- Reshape the features for the model
- Build the LSTM model, if adding additional LSTM layers, set return sequences to True. But not neccessary for final layer
- Compile the model
- Summarize the model
- Train the model
1.Evaluate the model using the X_test and the y_test data
- Create a DataFrame of Real and Predicited values
- Plot the real versus predicted value in a line chart
- Follow same steps above (Prepare Data, Build and Train the LSTM model, Model performence)
- summarize model, for this model I used a window size of 9
- Create DataFrame of Real and Predicited values
- Plot the real versus the predicited values as a line chart
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.