Skip to content

The main Objective of this project was to analyze the results of both LSTM and GRU on temporal dependencies of stock price data.

Notifications You must be signed in to change notification settings

Omkarnj/LSTM-vs-GRU-for-Algotrading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

LSTM-vs-GRU-for-Algotrading

The main Objective of this project was to analyze the results of both LSTM and GRU on temporal dependencies of stock price data.

I would like to first tell you the special part about this project - its flexibility. The code used in this project can be used with ANY stock/crypto/commodities that you desire. You only need to find its name on yahoo finance and replace that name with the one I used in the code. Then the Yahoo Finance (yfinance) package will download all the data about that symbol from the stipulated time period, which you can change too! just edit the end_date and the offset parameters in the code block. While I cannot guarantee similar performance on other stocks, the code will indeed run without any hickeys.

I have mainly used the closing prices of the stocks to predict their movement, in this example I used Kotak Bank historical stock price data, of which the closing prices over time are visualised below -

image

The data from 2023 and beyond would need to be predicted by the model, the entire train-test split is visualised below -

image

This is the real and predicted lines for the LSTM model on a graph -

image

The Root mean squared error is 21.28 for the LSTM model

GRU model -

image

The root mean squared error is 69.68 for the GRU model

Risk Mitigation: The lower RMSE obtained with the LSTM model suggests that it outperforms the GRU model in terms of prediction accuracy. This insight can guide stakeholders in choosing the most effective model for stock price forecasting. By utilizing the LSTM model, investors can mitigate risks associated with inaccurate predictions and make more reliable investment decisions. The comparison between the LSTM and GRU models highlights the importance of selecting the appropriate architecture for deep learning models in stock price prediction tasks. The superior performance of the LSTM model suggests that it may be better suited for capturing long-term dependencies and complex patterns in the data. This insight informs future model development efforts and underscores the significance of model architecture selection in achieving accurate predictions.

About

The main Objective of this project was to analyze the results of both LSTM and GRU on temporal dependencies of stock price data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published