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
- 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.
[
{
"Ticker": "AMZN",
"Future price after": "1 day",
"Predicted price for 2025-01-19": "222.50$",
"Mean absolute error": 0.8400973514772765,
"Accuracy score": 0.49963846710050613,
"Total buy profit": -27.72362196445463,
"Total sell profit": 7.874384522437994,
"Total profit": -19.849237442016637,
"Profit per trade": -0.014352304730308487,
"Generated": "2025-01-18 20:17:26.782589+08:00"
}
]
Ticker | Future price after | Predicted price for 2025-01-19 | Mean absolute error | Accuracy score | Total buy profit | Total sell profit | Total profit | Profit per trade | Generated |
---|---|---|---|---|---|---|---|---|---|
AMZN | 1 day | 222.50$ | 0.8400973514772765 | 0.49963846710050613 | -27.72362196445463 | 7.874384522437994 | -19.849237442016637 | -0.014352304730308487 | 2025-01-18 20:17:26.782589+08:00 |
Disclaimer: This is not finanical advice. Please don't bet your life savings on this.