Using a Long Short-Term Memory (LSTM) Recurrent Neural Network (RNN) to forecast the price of the S&P 500 index
No external data download is needed, courtesy of the yfinance library.
The baseline model only uses OHLCV data.
Make sure you satisfy the system requirements and are using the correct python version before downloading.
pip install numpy
pip install pandas
pip install matplotlib
pip install yfinance
pip install tensorflow
pip install keras
pip install sklearn- Prediction: One Step (next trading day)
- Activation Function: Linear
- Lookback Period: One year
- Steps: 70
Mean Absolute Error: 226.74624230089194
Future price after 1 days is 362.72$
1: Accuracy Score: 0.5555555555555556
The accuracy score of the one step prediction model is 55.6%. This is a 5.6% improvement over the 50% chance the price of the SPY goes up or down.
This is a substantial improvement, but as I will show in later excercises the longer the forecast window (e.g. 1 month) the more accurate a prediction.
Price Prediction Tutorial
Thank you to PythonCode for many of the functions used in this educational model.
