0% found this document useful (0 votes)
10 views

Decoding_Stocks_Patterns_Using_LSTM

The document discusses the use of Long Short-Term Memory (LSTM) networks for predicting stock prices, emphasizing their effectiveness in handling time series data. It details the methodologies employed, including data collection from Yahoo Finance and the pre-processing steps necessary for accurate predictions. The study aims to enhance predictive accuracy by integrating sentiment analysis and expanding its application to cryptocurrency trading.

Uploaded by

prakharteotia77
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Decoding_Stocks_Patterns_Using_LSTM

The document discusses the use of Long Short-Term Memory (LSTM) networks for predicting stock prices, emphasizing their effectiveness in handling time series data. It details the methodologies employed, including data collection from Yahoo Finance and the pre-processing steps necessary for accurate predictions. The study aims to enhance predictive accuracy by integrating sentiment analysis and expanding its application to cryptocurrency trading.

Uploaded by

prakharteotia77
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

International Journal of Scientific Research in Computer Science, Engineering

and Information Technology


ISSN : 2456-3307 Available Online at : www.ijsrcseit.com
doi : https://doi.org/10.32628/CSEIT2410328

Decoding Stocks Patterns Using LSTM


Dr. Madhur Jain1, Ms. Shilpi Jain2, Ankit Gupta3
1Assistant Professor, Department of IT, BPIT, University of Delhi, Delhi, India
2 Assistant Professor, Department of Mathematics, ARSD College, University of Delhi, Delhi, India
Student, Department of IT, BPIT, University of Delhi, Delhi, India
3

ARTICLEINFO ABSTRACT

Decoding stocks is extensively utilized in the financial sector by numerous


Article History:
organizations. It is volatile in nature, so it’s tough to predict the prices of stock.
Accepted: 10 May 2024 Numerous methodologies exist for tackling this task, including logistic regression,
Published: 20 May 2024 support vector machines (SVM), autoregressive conditional heteroskedasticity
(ARCH) models, recurrent neural network (RNN), convolutional neural networks
(CNN), backpropagation, Naïve Bayes, among others. Among these, Long Short-
Publication Issue Term Memory (LSTM) stands out as particularly adept at handling time series data.
Volume 10, Issue 3 The primary aim is to discern prevailing market trends and achieve accurate stock
May-June-2024 price forecasts. Leveraging LSTM and RNN , we strive for error free stock price
Page Number predictions, with promising results.
306-310 Keywords : Stock market, ML, DL, LSTM, CNN, Trade.

I. INTRODUCTION To forecast stock prices effectively based on prevailing


market trends, we employ machine learning
Decoding stocks involves anticipating current algorithms. Specifically, we utilize LSTM recurrent
trajectory of particular company's performance and neural networks to achieve accurate stock price
projecting whether its stock value will rise or fall. The predictions. In the realm of stock trading, there are
stock market serves as the platform where company's typically two types of stocks: Intraday trading, also
shares were exchanged. Each stock represents a stake known as day trading, involves closing all positions
in the ownership of the company, making investing in before the market closes for the day, thereby
stocks tantamount to owning a portion of the company precluding any changes in ownership after market
itself. LSTMs play a crucial role in this predictive hours.
process due to their ability to effectively handle
sequence prediction problems by retaining past II. LITERATURE SURVEY
information.
Stock Predicting stock prices is a prominent
application of AI and machine learning models in the

Copyright © 2024 The Author(s): This is an open-access article distributed under the terms of the Creative 306
Commons Attribution 4.0 International License (CC BY-NC 4.0)
Zalak L. Thakker et al Int. J. Sci. Res. Comput. Sci. Eng. Inf. Technol., May-June-2024, 10 (3) : 306-310

field. Among these models, Support Vector Machines


(SVM) stands out as a classification algorithm utilized
for predicting stock trends. Multiple Linear Regression
with Interactions has also been applied to forecast
stock price trends, with various studies corroborating
its effectiveness. The Random Walk Hypothesis,
proposed by Horne et al. (1997), posits that stock values
change randomly, independent of past price values,
influencing approaches to stock price prediction.

III. DATA COLLECTION

For our experimental study, we undertook a detailed


process to gather live datasets essential for our analysis.
We focused on prominent financial entities such as
Google, Nifty, and Reliance. To ensure accuracy and
timeliness, we sourced these datasets from the Yahoo
Finance website, a reputable and widely used platform
for financial data.
The acquisition involved systematically navigating
Yahoo Finance to locate and download the required
datasets. Yahoo Finance, accessible at
https://finance.yahoo.com/, offers an extensive
repository of financial information, including stock
prices, market indices, and company financials. This
ensured that we had access to a comprehensive range
of data necessary for our study.
By utilizing Yahoo Finance, we guaranteed that our
datasets were current and derived from a reliable
source. The platform's extensive data offerings were
crucial for performing a thorough analysis. The
datasets we obtained formed the backbone of our
Sample Input Table
research, allowing us to conduct an in-depth
investigation and derive meaningful insights.
IV. METHODOLOGIES
The use of Yahoo Finance was pivotal in ensuring our
data's quality and relevance, thus enhancing the
LSTM networks employ the Recurrent Neural
validity and robustness of our experimental results.
Network (RNN) architecture, which is notable for it’s
This comprehensive and reliable data foundation was
the cell capacity to retain information over time. This
essential for achieving the objectives of our research
memorization capability is pivotal in processing
study..
sequential data. A cell of LSTM comprises 3 critical
components which is reffered as gates: Input gate,

Volume 10, Issue 3, May-June-2024 | http://ijsrcseit.com 307


Zalak L. Thakker et al Int. J. Sci. Res. Comput. Sci. Eng. Inf. Technol., May-June-2024, 10 (3) : 306-310

Forget gate, and Output gate. These gates helps in flow are not. The specific attributes chosen for this process
of the information through the cell. include Trade Open, Trade High, Trade Low, and
As data enters the LSTM network, the input gate Trade Close. These attributes are pivotal as they
determines which values from the input should be provide crucial insights into the trading patterns and
updated. The forget gate then plays a crucial role by market behaviors, which are essential for accurate
deciding which information from the previous cell analysis. Once the relevant attributes are selected, we
state should be discarded, effectively "forgetting" employ normalization techniques to adjust their values
irrelevant data. Finally, the output gate selects the to fall within a specific range. Normalization is a
useful information that will be passed on to the next critical step in data pre-processing as it ensures that all
cell in the sequence. This gated structure enables LSTM attributes contribute equally to the analysis,
networks to maintain long-term dependencies, making preventing any single attribute from
them highly effective for tasks that involve time series disproportionately influencing the model due to its
data, such as natural language processing and time scale. By scaling the values, normalization also helps in
series forecasting. speeding up the convergence of the algorithm and
improves its overall performance. This methodical
In the context of developing a general-purpose image approach to data pre-processing not only streamlines
segmentation system, the initial step involves careful the dataset but also enhances the algorithm's ability to
data selection. This process includes gathering a learn effectively from the data. By focusing on essential
comprehensive dataset and subsequently dividing it attributes and applying normalization, we ensure that
into two distinct subsets: one for training the model the data is in the optimal form for analysis, leading to
and one for testing its performance. For our study, we more accurate and reliable results in subsequent stages
designated 75% of the dataset for training purposes, of the study.
ensuring that the model has ample data to learn from.
The remaining 25% of the data was reserved for testing, Prediction using LSTM: Utilizing LSTM for Predictive
allowing us to evaluate the model’s effectiveness and Modeling: Within this framework, we employ the
generalize its performance on unseen data. This LSTM algorithm to calculate values of stock. Initially,
stratified approach to data allocation helps in building training data undergoes training within system to
a robust and reliable image segmentation system by refine the model. Subsequently, during testing phase,
ensuring that the model is both well-trained and the predicted values are juxtaposed with the actual
thoroughly tested. values to gauge model's accuracy and efficacy.
The versatility of LSTM extends beyond stock
prediction; it finds applications in diverse domains
such as forecasting of weather, natural language
processing, speech and handwriting recognition, and
time-series prediction. LSTM's efficacy in handling of
sequential data, retaining long-term dependencies, and
mitigating the improve the gradient problem makes it
particularly well-suited for these tasks.

Pre-processing of data: Data Pre-processing: In the pre- The script utilizes a neural network model consists of
processing phase, we focus on selecting the attributes three LSTM layers with 50 units each, followed by a
necessary for the algorithm and disregarding those that dense layer with one unit. The input shape for the

Volume 10, Issue 3, May-June-2024 | http://ijsrcseit.com 308


Zalak L. Thakker et al Int. J. Sci. Res. Comput. Sci. Eng. Inf. Technol., May-June-2024, 10 (3) : 306-310

model is determined based on the time step size, which


is dynamically calculated based on the size of the
training and testing data. The model is compiled using
the mean squared error loss function and the Adam
optimizer. During training, the model is fit to the
training data with a batch size of 32 and for 100 epochs.
After training, the model is used to make predictions
on future stock prices. The total number of parameters Graph:
in the model is calculated by considering the
parameters in each layer, including weights and biases.
For instance, with three LSTM layers, each having 50
units, and a dense layer, the total number of parameters
is approximately 41,201.

American Airlines Group:

Stock Table:

V. EXPERIMENTAL RESULTS

Enclosed within are the experimental findings


pertaining to the chosen company, accompanied by
thorough stock tables and elucidative graphical
representations. These visual aids serve to provide
deeper understanding and clearer interpretation of the
data, facilitating analysis of experimental results.

Apple:

Volume 10, Issue 3, May-June-2024 | http://ijsrcseit.com 309


Zalak L. Thakker et al Int. J. Sci. Res. Comput. Sci. Eng. Inf. Technol., May-June-2024, 10 (3) : 306-310

yielding more precise forecasts. By integrating


sentiment analysis, our application will evolve into a
compre hensive tool for financial forecasting, offering
users valuable insights into market trends and
facilitating informed decision-making.

In essence, our application represents a multifaceted


approach to financial prediction, leveraging advanced
The comprehensive array of data encapsulated within algorithms and diverse datasets to provide
these stock tables serves as a cornerstone for comprehensive insights into both traditional and
meticulous examination of historical stock emerging markets. Through continuous innovation
performance. This thorough analysis is pivotal in and expansion, we aspire to empower users with the
refining the accuracy of our pre dictions regarding tools they need to navigate and capitalize on the
future market trends, achieved through the complexities of modern fina ncial landscapes.
sophisticated algorithms employed, notably our LSTM
models. By delving into these insights, we fortify our V. REFERENCES
decision-making processes in financial forecasting,
thus augmenting the reliability and efficacy of our [1]. Pranav Bhat Electronics and
predictive frameworks to navigate the complexities of Telecommunication Department, Maharashtra
the stock market landscape. Institute of Technology. Savitribai Phule Pune
University - ML Model for Stock Market
VI. CONCLUSION Prediction.
[2]. Stock Price Prediction Using LSTM on Indian
Our initiative focuses on predicting the closing stock Share Market by Achyut Ghosh, Soumik Bose1,
prices of diverse organizations through an application Giridhar Maji, Narayan C. Debnath, Soumya Sen
driven by LSTM algorithms. This application harnesses [3]. S. Selvin, Vinayakumar, E. A. Gopalkrishnan, V.
datasets sourced from prominent entities such as K. Menon – prediction of stocks using LSTM,
Google, TCS, Nifty50, Infosys, and Reliance Stocks for RNN and CNN-sliding window model - 2017.
both training and prediction purposes. As we envision [4]. Murtaza Rondiwala, Shraddha Varma,
the future trajectory of our project, we aspire to extend “Predicting Prices of Stock” in Undergraduate
its capabilities beyond conventional stock markets. Engineering Students, Department of
One avenue for expansion involves integrating Information Technology, Mumbai University.
cryptocurrency trading prediction functionalities, [5]. Xiongwen, Zhou, Pan Wang, Weiwei Lin, “An
broadening our scope to encompass the dynamic innovative neural network approach for stock
landscape of digital assets. market prediction”, 2018
[6]. Tran Phuoc, applying ML algorithms to predict
Furthermore, we aim to enhance the predictive the stock price trend in the stock market – The
accuracy of our application by incorporating sentiment case of Vietna
analysis into its framework. This addition will enable [7]. Anurag Sinha Department of computer science,
the application to analyze market sentiment and factor Student, Amity University Jharkhand Ranchi,
it into its predictions, providing a more nuanced Jharkhand, 834001 - Stock Prediction Using
understanding of market dynamics and potentially Machine Learning.

Volume 10, Issue 3, May-June-2024 | http://ijsrcseit.com 310

You might also like