LTSM Stock Predictor
Predicting different stock prices using Long Short-Term Memory Recurrent Neural Network in Python using TensorFlow 2 and Keras. Highly customizable for different stock tickers. Current ticker: AMZN (Amazon).
View deployment here:
GitHub Pages
Basic Usage
- Install the required libraries by running pip install -r requirements.txt.
- Run train.py to train our model. (This will take some time approx. 4 hours)
- After training ends, run tensorboard –logdir=”logs” to view the Huber loss as specified in the LOSS parameter, the curve is the validation loss. You can also increase the number of epochs to get much better results.
- Run test.py to test the model and to output the result
Note: the project is currently running on GitHub Actions, you can take a look at the example output down below. GitHub Actions allows the code to be ran offsite hence freeing up your development computer.
Raw data
[
{
"Ticker": "AMZN",
"Future price after": "1 day",
"Predicted price for 2025-02-02": "238.09$",
"Mean absolute error": 0.7639587805310004,
"Accuracy score": 0.4981949458483754,
"Total buy profit": 20.030359268188484,
"Total sell profit": 1.7735197693109692,
"Total profit": 21.803879037499453,
"Profit per trade": 0.015742872951263143,
"Generated": "2025-02-01 20:14:14.019119+08:00"
}
]
Generated report
Ticker | Future price after | Predicted price for 2025-02-02 | Mean absolute error | Accuracy score | Total buy profit | Total sell profit | Total profit | Profit per trade | Generated |
---|---|---|---|---|---|---|---|---|---|
AMZN | 1 day | 238.09$ | 0.7639587805310004 | 0.4981949458483754 | 20.030359268188484 | 1.7735197693109692 | 21.803879037499453 | 0.015742872951263143 | 2025-02-01 20:14:14.019119+08:00 |
Graphs
Disclaimer: This is not finanical advice. Please don’t bet your life savings on this.