You are on page 1of 27

STOCK PREDICTION

A PROJECT REPORT

Submitted by
Binayak Kumar Mahato (22BET10356)
Rakesh Chandra Mahato (22BET10340)
Amar Kumar Mandal (22BET10379)
Abhinav Paswan (22BET10332)
Rajnish Kumar (22BET10359)

In partial fulfillment for the award of the degree of

BACHELOR OF ENGINEERING
IN

INFORMATION TECHNOLOGY

Chandigarh University

February – June 2023


BONAFIDE CERTIFICATE

Certified that this project report “STOCK PREDICTION” is the bonafide work of
“Binayak Kumar Mahato, Abhinav Paswan, Amar Kumar Mandal, Rajnish
Kumar, Rakesh Chandra Mahato” who carried out the project work under my/our
supervision.

SIGNATURE SIGNATURE

Dr. Gyanendra Singh Ms. Saweta Verma


HEAD OF THE DEPARTMENT SUPERVISOR
Academic Unit – 3 Assistant Professor
Academic Unit – 3

Submitted for the project viva-voce examination held on

INTERNAL EXAMINER EXTERNAL EXAMINER


TABLE OF CONTENTS
Contents
List of Figures ................................................................................................................................. 4
CHAPTER 1 ................................................................................................................................... 5
INTRODUCTION ....................................................................................................................... 5
1.1 Identification of Client / Need / Relevant Contemporary issue ......................................... 5
1.2 Identification of Problem ................................................................................................... 7
1.3 Identification of Tasks ....................................................................................................... 8
1.4 Timeline ............................................................................................................................. 9
1.5 Organization of the Project .............................................................................................. 10
CHAPTER 2 ................................................................................................................................. 11
LITERATURE REVIEW/BACKGROUND STUDY .............................................................. 11
2.1 Timeline of the reported problem .................................................................................... 11
2.2 Existing Solutions ............................................................................................................ 12
2.3 Review Summary ............................................................................................................ 13
2.4 Problem Definition .......................................................................................................... 15
2.5 Goals/Objectives .............................................................................................................. 16
CHAPTER 3 ................................................................................................................................. 17
DESIGN FLOW/PROCESS ..................................................................................................... 17
3.1 Evaluation & Selection of Specification/Features ........................................................... 17
3.2 Design Constraints ........................................................................................................... 18
3.3 Analysis of Features and finalization subject to constraints............................................ 19
3.4 Design Flow ..................................................................................................................... 20
3.5 Design Selection .............................................................................................................. 21
3.6 Implementation Plan/Methodology ................................................................................. 22
CHAPTER 4 ................................................................................................................................. 23
Result Analysis and Validation ................................................................................................. 23
4.1 Implementation of Solution ............................................................................................. 23
CHAPTER 5 ................................................................................................................................. 25
CONCLUSION AND FUTURE WORK .................................................................................. 25
5.1 Conclusion ....................................................................................................................... 25
5.2 Future Work ..................................................................................................................... 26
List of Figures
Fig 1 : Gantt Chart………………………………………………………………9
Fig 2 : Homepage..………………………………………………………………23
Fig 3 : High vs Lows……………………………………………………………..24
Fig 4 : Stock Market Volume…………………………………………………...24
CHAPTER 1
INTRODUCTION

1.1 Identification of Client / Need / Relevant Contemporary issue


The stock market is a public market for buying and selling shares of publicly traded companies. It
provides a platform for companies to raise capital by selling ownership stakes (shares) to investors,
who in turn can trade those shares with other investors in the open market. The value of a
company's stock is influenced by a variety of factors, including its financial performance, market
trends, news events, and investor sentiment. The stock market can be volatile, with prices
fluctuating rapidly based on changing economic conditions, company news, and other factors.
Investing in the stock market can be a way for individuals to grow their wealth over time, but it is
important to do so with careful consideration of one's goals, risk tolerance, and investment horizon.
It is recommended to seek advice from a financial professional before making any investment
decisions.

Predicting the future performance of stocks is a complex task that involves a variety of factors,
including the overall state of the economy, the company's financial health, market trends, and
investor sentiment. While there are many techniques and methods used to predict stock prices, no
method is 100% accurate.

Some common methods used for stock prediction include fundamental analysis, technical analysis,
and machine learning algorithms. Fundamental analysis involves examining a company's financial
statements, management, and industry trends to evaluate its overall health and potential for growth.
Technical analysis involves analyzing past price and volume data to identify patterns and trends
that may predict future price movements. Machine learning algorithms can use a variety of data
sources and models to predict stock prices based on historical data and market trends.

However, it's important to note that stock prices can be influenced by unexpected events, such as
global pandemics, political turmoil, or natural disasters. Therefore, it's important to have a
diversified portfolio and consider long-term investment strategies that can weather short-term
market fluctuations.

Stock prediction model are important for various reasons,


• Investment Decision-making:
Stock prediction models can be used by investors to make informed investment decisions
based on the predicted performance of a company's stock.
• Risk Management:
Stock prediction models can help investors manage risk by providing insight into potential
market fluctuations and trends.
• Trading Strategies:
Stock prediction models can be used to develop trading strategies that take advantage of
predicted price movements.
• Portfolio Management
Stock prediction models can be used to manage portfolios and optimize investment returns
by selecting the right mix of stocks.

Overall, stock prediction models can provide valuable insights and help investors make more
informed decisions about their investments.
1.2 Identification of Problem

The problem statement of a stock prediction model is to develop an accurate and reliable predictive
model that can forecast the future prices or trends of a particular stock or portfolio of stocks. The
primary objective is to help investors make informed decisions and manage their portfolio
effectively by predicting the potential risks and returns associated with specific stocks. However,
the development of a successful stock prediction model is challenging due to the complex and
volatile nature of the stock market, the various factors influencing stock prices, and the inherent
unpredictability of the market. Therefore, the goal is to address these challenges and develop a
model that can effectively analyze the historical data, identify trends and patterns, and make
accurate predictions for future stock prices. Ultimately, the success of the stock prediction model
will depend on its ability to provide investors with reliable and actionable insights that can inform
their investment decisions and ultimately maximize their returns.
1.3 Identification of Tasks

• Dataset Collection: The main goal of dataset collection is to collect the perfect and
effective dataset of various stocks like of Netflix, Microsoft, Google, Uber and so on. The
dataset will be used for the prediction and giving the accurate assumption based on the past
data of the company.
• Processing the Dataset: The collected dataset will be processed using the LTSM
model which is the model based on RNN model used to predict the various data. LTSM is
an model which will retain the processed data for the long period of time so this model will
be used into this project.
• Comparing different ML Algorithms/Literature Review: The next step in
this prediction model is to analyze the various data and compare it with the different
machine learning model. The accuracy of the model will be given the high priority for the
selection of the model. The accuracy and recall of the value is most in the selection of the
model for the project.
• Problem Formulation: After the comparison of the processed data with the different
model, the processed data will be visualized into the image form. The Confusion matrix
will be used for finding the outcome of the accuracy of the predicted data.
• Selecting the suitable ML model: The selection of the model will be based on the
accuracy of the model. The predicted data will be compared and the best among all will be
used into the project for the reliable prediction of the Stocks. This model will help to gain
the maximum profit.
• Predicting future Value of the Stocks: The model will predict the maximum and
minimum value of the stock at the particular time. So the user will be well known about
the correct time to sell the stock and gain the maximum profit.
1.4 Timeline

Fig 1 : Gantt Chart


1.5 Organization of the Project

Chapter 1: Problem Identification: This chapter introduces the list of problem that the
project is going to solve and it also shows the targeted audiences. This chapter deals with the
problem statement of the project. The needs which will be solved by the project will be included
in this chapter.

Chapter 2: Literature Review: This chapter will help the reader to understand the overall
review of the other project related to stock prediction and it will also talk about the technology
used in the other previous project done by others. We can further know what we can implement
into the project from this chapter.

Chapter 3: Design Flow/Process: Design flow simply means the design and the flow of the
project. It will show the working of the project using the flowchart diagram. It will also explain
the process how the project is working and the model are functioning.

Chapter 4: Conclusion and Future Scope: This chapter includes the overall conclusion
of the project and also the further expansion of the project. This chapter will show the use of project
in real life scenario. This chapter conclude the project by including the model, the technique, and
the dataset used here. The chapter will also explore the need of this project for the user and the
targeted audiences.
CHAPTER 2
LITERATURE REVIEW/BACKGROUND STUDY

2.1 Timeline of the reported problem


The timeline for the evolution of stock prediction methods over the years are:

Early models (pre-1980s): The earliest attempts at predicting stock prices relied on statistical
models and simple heuristics. These models typically used technical indicators, such as moving
averages and trading volumes, to make predictions.

Regression-based models (1980s-1990s): In the 1980s, researchers began to use linear regression
models to predict stock prices. These models relied on a set of independent variables, such as
earnings, dividends, and interest rates, to make predictions.

Machine learning models (2000s-2010s): In the 2000s, researchers began to use more
sophisticated machine learning algorithms, such as support vector machines and random forests,
to predict stock prices. These models could handle larger datasets and were able to capture more
complex relationships between variables.

Deep learning models (2010s-present): In recent years, researchers have turned to deep learning
models, such as neural networks, to predict stock prices. These models are capable of processing
large amounts of data and can capture complex patterns in the data that may not be visible to other
models.

The evolution of the project has been to the model called Deep Learning which is the most efficient
model for the prediction purpose. Although there is the frequent change in the data the Deep
Learning algorithms can manage the prediction with high accuracy than all.
2.2 Existing Solutions
According to the paper review we have found there are many existing solution for the stock
prediction model. Some of the possible existing model that have been used for stock prediction are
listed below.

LSTM-based models: Long Short-Term Memory (LSTM) models have become a popular choice
for stock prediction because they can handle sequential data and capture temporal dependencies in
the data. These models have been used to predict stock prices, stock volatility, and stock trading
volumes.

Random forest models: Random Forest models are a type of decision tree model that have been
used for stock prediction because they can handle high-dimensional data and capture complex
nonlinear relationships between variables. These models have been used to predict stock prices,
stock returns, and stock trading volumes.

Support vector regression models: Support vector regression (SVR) models have been used for
stock prediction because they can handle noisy data and capture nonlinear relationships between
variables. These models have been used to predict stock prices, stock volatility, and stock trading
volumes.

Deep learning models: Deep learning models, such as convolutional neural networks (CNNs) and
autoencoders, have been used for stock prediction because they can handle large amounts of data
and capture complex relationships between variables. These models have been used to predict
stock prices, stock volatility, and stock trading volumes.

Ensemble models: Ensemble models, which combine multiple models to improve prediction
accuracy, have been used for stock prediction. For example, a combination of LSTM and random
forest models may be used to improve prediction accuracy.

After analyzing all the model that can be used for stock prediction we have decided to choose the
model named LSTM-based model. The choice of the model depends on the specific requirements
of the project, including the size of the data, type of the data, and the prediction horizon. It is
important to evaluate the performance of the different models on a validation set and choose the
model with the best performances.
2.3 Review Summary

Progress and prospects of data-driven stock price forecasting research. (n.d.). In ScienceDirect.
Retrieved April 10, 2023, from https://www.sciencedirect.com/journal/international-journal-of-
cognitive-computing-in-engineering In this article author review the literature of stock price
forecasting method which is work on model and feature. From the perspective of method, it is
divided into statistic analysis, traditional machine learning and deep learning method. From a
feature perspective it is divided into numerical data based and text and numerical data based.

Htet. (n.d.). Survey of feature selection and extraction techniques for stock market prediction. This
article tells the importance of identifying the critical features for accurate stock market forecasting
using the machine learning models. In this article author conducted a systematic search of 32
research works in the Scopus and web of science databases from 2011 to 2020, and analysize a
various types of feature and extraction approaches which can be used in stock market analyses.
They evaluated the accuracy of these technique in combination with ML method and found that
correlation criteria, random forest, principle component analysis, and auto encoder were the most
widely used and effective techniques for predicting stock market data.

(n.d.). Machine learning approaches in stock market prediction: A systematic literature review.
This article discuss the traditional methods and machine learning in stock market prediction. Due
to machine learning stock market prediction become more accessible and accurate and various
machine learning applied in this area. The approaches which is used includes neural networks and
support vector machines and they found that the most commonly used model is neural networks.
However, the author note that this does not necessarily mean that other models cannot be effective
in predicting the stock market.

(n.d.). Stock Market Prediction Techniques Using Artificial Intelligence: A Systematic Review. In
this article reviewer collected 6222 research work from 12 databases and reviewed the full text of
10 studies in preliminary search and 70 studies selected based on PRISMA. This review is
conducted using the PRISMA based Python framework. This reviewed literature is categorized
into detailed information on prediction techniques, competitor techniques, performance metrics,
input variables, data timing, and research gaps. In this article the majority of the reviewed studies
showed significant improvements in predictions compared to previous systems.

(n.d.). Predicting stock market using machine learning: best and accurate way to know future stock
prices. This article discusses the use of Artificial intelligence in predicting stock prices. The three
methods implemented in this predicting model were Artificial Neural Network (ANN), Support
Vector Machine (SVM) and Long Short-Term Memory. ANN is based on network which provides
the best result as it considers complex, nonlinear relationships and recognizes patterns. SVM is a
newly generated method that has the potential to provide better results in the future, on the other
hand LSTM gives good results only when the given datasets Is very large, which can be considered
a drawback.

(n.d.). A machine learning trading system for the stock market based on N-period Min-Max
labeling using XGBoost. This article discusses the difficulties of predicting the stock price
accurately by the use of machine learning and deep learning because of the nonlinearity and
randomness of stock prices. Most of the studies uses up down labelling method which labelled the
data at all time point. The study proposes an N-Period Min-Max labelling method that labels data
only at definite time points to overcome this sensitivity. This model also develops a trading system
by the use of XG Boost to automate trading and verify the labelling method. The study assesses
the proposed trading system on 92 Companies listed on NASDAQ and compares the performance
of the proposed labelling method against other prominent labelling methods. The authors come to
the conclusion that the NPMM labelling method was efficient for stock price trend prediction and
generated trading outperformance compared to other labelling methods.
2.4 Problem Definition

The problem of stock prediction involves developing a model that can accurately predict the future
price or direction of a stock or group of stocks. The goal is to use historical data, along with other
relevant data sources, to build a model that can make predictions about future market trends and
stock prices.

The problem of stock prediction is challenging because the stock market is complex and influenced
by many factors that can be difficult to capture and model. These factors can include economic
indicators, political events, news and social media sentiment, and other external factors that can
affect the behavior of the market.

Additionally, stock prices can be highly volatile and subject to sudden shifts or unpredictable
events, which can make it difficult to develop accurate and reliable models.

Despite these challenges, the problem of stock prediction is of significant interest to investors,
traders, and financial institutions who are seeking to make informed decisions about buying and
selling stocks. As a result, there has been extensive research and development in the field of stock
prediction, with a focus on developing models that can accurately capture the complex dynamics
of the market and make reliable predictions about future stock prices.
2.5 Goals/Objectives

Goals
The main goal of the project is to provide the user with accurate model that can predict the price
of the stock more accurately.

Objectives

1. To collect the dataset from different sources so that the training of the data can be done
effectively.
2. To train the model for accurate prediction.
3. To select the model on the basis of accuracy and consistency.
4. To decrease the risk while buying and selling the stocks.
5. To give the user a perfect idea that when to sell the stocks.
6. To include the LSTM model into the project.
CHAPTER 3
DESIGN FLOW/PROCESS
3.1 Evaluation & Selection of Specification/Features
The feature that has been used into the literature review that the authors has explained are as
follows:

1. According to the “Progress and Prospects of data-driven stock price forecasting research”
The author has explained the forecasting method and he has also categorized them based
on model and features. According to him he has classified methods into statical analysis,
traditional machine learning and deep learning methods.

2. According to the “Survey of feature selection and extraction techniques for stock market
prediction” Correlation criteria, random forest, principal component analysis, and
autoencoder were found to be the most popular and efficient ways for forecasting stock
market movements after they analyzed the efficacy of these techniques in combination with
ML methodologies. Additionally, the authors provided stock market information, other
survey articles, and analyses based on various variables.

3. According to the “Machine Learning approaches in stock market prediction: A Systematic


literature review” Different machine learning techniques have been used in this field to
improve stock market predictions' accessibility and accuracy. Using a methodical literature
review, the study sought to examine 30 pertinent works on machine learning models used
in stock market prediction. The methods used included support vector machines and neural
networks, and the study discovered that neural networks were the most widely used model
for stock market forecasting. The authors point out that this does not preclude the use of
other models for stock market forecasting, either.
3.2 Design Constraints
After the analysis of all the research paper and review paper we have found the following Design
Constrains into the project “Stock Prediction”. The Constrains in the previous made design are:

1. Overfitting: Machine learning algorithms can sometimes "overfit" to historical data,


meaning they become too specific to past patterns and are less accurate at predicting new
data. This can happen if the algorithm is too complex or if there isn't enough data to train
it.

2. Data Pre-Processing Challenges: Before using machine learning algorithms to predict stock
prices, the data must be cleaned, preprocessed, and feature engineered. This can be a time-
consuming and challenging process, particularly if the data is messy or incomplete.

3. Ethics and Regulatory Concerns: The use of machine learning for stock price prediction
raises ethical and regulatory concerns. For example, using predictive algorithms to make
investment decisions could be considered insider trading or market manipulation.
3.3 Analysis of Features and finalization subject to constraints
The features that the previous model has is:

1. It predicts on the basis of too old data and it uses the traditional approaches.
2. It uses the technology like Machine Learning, Random Forest and so on.
3. It used the technique like XGBoost and so on.
4. It has used the technique like Tanserflow and it makes the program slow as the prediction
takes a lot of time.

The Features we are going to implement in our project are:

1. We will be taking the dataset from various sources and used it for prediction.
2. We will be doing the prediction for two stocks for now.
3. We will be using the technique like Numpy for the calculation as it is the fastest model.
4. We have used Keras for the prediction based on the previous data.
3.4 Design Flow

`
Data Collection

Processing the Dataset

Finalizing the Model

Comparing trained data with raw data

Visualizing the Data


3.5 Design Selection

We have selected the design that uses the Keras Long Short Term Memory. We have selected this
design as it can hold the predicted data for the long term. And it has more accuracy than other.
Keras is a popular deep learning library built on top of TensorFlow. It provides an easy-to-use
interface for building neural networks, allowing developers to focus on the design of the model
rather than the implementation details. Keras also provides pre-trained models and tools to
simplify common deep learning tasks, such as image recognition and natural language processing.

While Keras can be used for a variety of applications, it is not the best tool for predicting stock
prices. Stock price prediction is a complex task that involves analyzing a wide range of data,
including historical prices, market trends, news events, and other factors that can affect the stock
market. To accurately predict stock prices, you need to use advanced machine learning techniques,
such as time-series analysis, feature engineering, and deep learning.

Therefore, while Keras can be used for developing and training deep learning models, it is not
specifically designed for predicting stock prices. There are other specialized tools and libraries that
are better suited for this task, such as scikit-learn, XGBoost, and TensorFlow's Time Series API.
These tools offer more advanced features for time-series analysis and forecasting, making them
better choices for predicting stock prices.
3.6 Implementation Plan/Methodology

Start

Import Different Model for reading


the files and Predicting the data

Read CSV file

Split Data and train using the


keras model

Compare the data with the


trained model

Visualize the prediction using


Matplotlib

End
CHAPTER 4

Result Analysis and Validation

4.1 Implementation of Solution

Discovering the future worth of business stock and other financial assets traded on an exchange is
made possible with the aid of stock price prediction utilizing machine learning. Gaining significant
profits is the whole point of making stock price predictions. The solution can be used by the trade
in personal level or in organization level. The project is totally based on old data of the company
so it is able to predict the value of future stock with high accuracy and in less time.

It can be taken in use when the person wants to buy the national or international stocks and he/she
don’t have any knowledge of the stocks. So, the project comes in work at this moment. And the
investor can mange the risk of loss.

The System is easy to use so the investor doesn’t need the high knowledge of the computer. As
the interface is so easy and more continent.

Fig 2 : Homepage of the Stock Prediction System


Fig 3 : High vs Lows

Fig 4 : Stock Market Volume


CHAPTER 5

CONCLUSION AND FUTURE WORK

5.1 Conclusion

The stock prediction system using Keras LSTM (Long Short-Term Memory) is a powerful tool
that utilizes deep learning techniques to forecast future stock prices based on historical data. After
analyzing and processing the input data, the LSTM model can learn patterns and dependencies in
the time series data, allowing it to make predictions with a certain degree of accuracy.

The project takes out the solution that it can predict the price of the stock on the basis of given
data. The project works on the model of RNN and it uses the Keras model to predict the price of
the stock. And it compares the real price of the stock with the predicted price so that the user or
the trader can have the clear information regarding the price of the stocks. The Project can be
implemented in low cost than the other project which is still existing in the market.
5.2 Future Work

Although the project is completed with the easy-to-use interface for the user. There is lot more
work to be done into the project. The major work there exists the training the model best so that
the accuracy of the model would be so high. The user can trust the model if the prediction of the
stock is done accurately with high accuracy and in less time.

In future we can add the option for other multiple stocks and the other more factor that after the
alteration of the stocks. We can add the option so that the user can enter the name of the stocks
and can see the prediction in upcoming days.
Team Roles
Member Name UID Roles
Amar Kumar Mandal 22BET10379 - Collecting and
making of the dataset.
- Visualization of the
dataset.
- Comparing the model.
Rajnish Kumar 22BET10359 - Collecting the dataset.
- Visualization of the
dataset.
Rakesh Chandra Mahato 22BET10340 - Collecting of the
dataset.
- Visualization of the
dataset.
Abhinav Paswan 22BET10332 - Testing and Training
of the data.
- Testing the model.
Binayak Kumar Mahato 22BET10356 - Testing and training
the dataset.
- Training the Model.
- Finding the best
model.
- Implementation of the
model.

You might also like