Skip to content

Predicting different stock prices using Long Short-Term Memory Recurrent Neural Network in Python using TensorFlow 2 and Keras.

Notifications You must be signed in to change notification settings

yapkhaichuen/LTSM-Stock-Predictor

Repository files navigation

LTSM Stock Predictor

Model Training Generate Report

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

  1. Install the required libraries by running pip install -r requirements.txt.
  2. Run train.py to train our model. (This will take some time approx. 4 hours)
  3. 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.
  4. 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 2024-06-30": "189.73$",
        "Mean absolute error": 0.7487066986547809,
        "Accuracy score": 0.48044280442804427,
        "Total buy profit": -0.5145261958242111,
        "Total sell profit": -16.490291178226474,
        "Total profit": -17.004817374050685,
        "Profit per trade": -0.012549680718856595,
        "Generated": "2024-06-29 20:13:26.036448+08:00"
    }
]

Generated report

TickerFuture price afterPredicted price for 2024-06-30Mean absolute errorAccuracy scoreTotal buy profitTotal sell profitTotal profitProfit per tradeGenerated
AMZN1 day189.73$0.74870669865478090.48044280442804427-0.5145261958242111-16.490291178226474-17.004817374050685-0.0125496807188565952024-06-29 20:13:26.036448+08:00

Graphs

graph

Disclaimer: This is not finanical advice. Please don't bet your life savings on this.

About

Predicting different stock prices using Long Short-Term Memory Recurrent Neural Network in Python using TensorFlow 2 and Keras.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages