This is PyTorch implementation of the LSTM(Long-short-term memory) model to predict prices of day-to-day stock data.
- Use Python 3.10.9
- Git clone using
git clone https://github.com/ChaitanyaKatti/lstm-stock-predictor.git
- Install requirements using
pip install -r requirements.txt
- Download stock data and place the .csv files in
/data/stocks
folder - Edit data, model, training, and simulation parameters in
config.py
. - Run main.py using
python main.py
- Look at the terminal for training progress and the
/plots
folder for results.
This architecture allows for
- Different input(x) and output(y) features
- Different input and output lengths
- The long-term memory state ('c') to be maintained across both LSTMs
Figure 1: Forward pass in a standard LSTM |
Figure 2: Recurrency input in LSTM |
Figure 3: LSTM Architecture in this implementation (Note: Both x and y differ in size and so does input and output length) |
Figure 4: Loss Curve over training |
Figure 5: Prediction |
Figure 6: Market simulation results |