Major 12211

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Stock Price Prediction

Samrat Ashok Technological Institute, Vidisha


(An Autonomous Institute Affiliated to RGPV, Bhopal)

Submitted by
VAIDIK SHRIVASTAVA (0108CS201132)
SHUBHAM NANDA (0108CS201117)

Under Supervision of
Prof. Mukesh Azad

Submitted to
Prof. Mukesh Azad

Department of Computer Science & Information Technology


Samrat Ashok Technological Institute
Vidisha (M.P.) – 464001
2023-24
Samrat Ashok Technological Institute
Vidisha (M.P.)
Department of Computer Science & Information Technology
TeTechnology

CERTIFICATE
This is to certify that the Major Project entitled “Stock Price Prediction”
submitted by Vaidik Shrivastava (Enrolment no. 0108CS201132), Shubham Nanda
(Enrolment No. 0108CS201117), in the partial fulfilment of the requirements for
the award of degree of Bachelor of Technology in the specialization of Computer
Science and Engineering from Samrat Ashok Technological Institute, Vidisha
(M.P.) is a record work carried out by him under my supervision and guidance.
The matter presented in this report has not been presented by him elsewhere for
any other degree or diploma.

Prof. Mukesh Azad Prof. Mukesh Azad Dr. Kanak Saxena


(Project Guide) (Project Coordinator) (H. O. D.)
Assistant Professor, Assistant Professor, Computer Science &
Computer Science & Computer Science & Information Technology
Information Technology Information Technology Samrat Ashok Technological
Samrat Ashok Technological Samrat Ashok Technological Institute,
Institute, Institute, Vidisha (M.P.)
Vidisha (M.P.) Vidisha (M.P.)
CANDIDATE’S DECLARATION

“I, Vaidik Shrivastava (Enrolment no. 0108CS201132), Shubham Nanda


(Enrolment No. 0108CS201117), hereby declare that the work which is being
presented in the Major Project entitled “Stock Price Prediction” submitted in
partial fulfillment of the requirement for the award of the degree of Bachelor of
Technology in Computer Science and Engineering. The work carried at Samrat
Ashok Technological Institute, Vidisha is an authentic record of my own work
carried out under the guidance of Prof. Mukesh Azad (Assistant Professor,
Department of Computer Science & Information Technology), Samrat Ashok
Technological Institute, Vidisha (M.P).

The matter embodied in this report has not been submitted by me for the award
of any other degree or diploma.

Date:

Place: Vidisha, (M.P)

Signature of Candidate Signature of Candidate

Vaidik Shrivastava Shubham Nanda

Enrollment No.: Enrollment No.:


0108CS201132 0108CS201117

Samrat Ashok Samrat Ashok


Technological Institute, Technological Institute,
Vidisha, (M.P) Vidisha, (M.P)
ACKNOWLEDGEMENT

When I started making this Major Project with my teammates, we faced various
problems then we found the information that helped us get a better knowledge of
how to develop an efficient Stock Price Prediction and I am glad that I was able to
complete this project along with my teammates and research this field. The
preparation of this project was an immense learning experience, and we inculcated
many personal qualities during this process like accountability, regularity, and self-
confidence.

I would like to thank my Guide, Prof. Mukesh Azad who supported us throughout
the process cleared our doubts with a thorough explanation and motivated us to add
different and new things to our project, our Project Coordinator, Prof. Mukesh
Azad, who guided us to choose this topic and kept the record of our progress, and
to our respected HOD, Dr. Kanak Saxena Ma’am, who also played a big role in the
finalization of our project file. I am taking this opportunity to acknowledge their
support and I hope that they keep supporting us like this in the future. This project
is a bridge between theoretical and practical learning and with this thought process,
we worked on the project and made it successful. Once again, I would like to thank
my teammates and guides for their encouragement and assistance in designing this
project to life.

Signature of Candidate Signature of Candidate


Vaidik Shrivastava Shubham Nanda
Enrollment No.: Enrollment No.:
0108CS201132 0108CS201117
Samrat Ashok Samrat Ashok
Technological Institute, Technological Institute,
Vidisha (M.P) Vidisha (M.P)
TABLE OF CONTENTS

SNO. TITLE

1. Problem Statement

2. Aims and Objectives

3. Review of Existing Model

4. Methodology

5. Expected Outcomes

6. References
PROBLEM STATEMENT
The project's objective is to develop a web application for stock price prediction
utilizing machine learning techniques to provide reliable forecasts of future stock
prices. This sophisticated model incorporates historical stock data, market
indicators, and pertinent information to make precise predictions. The primary aim
is to furnish investors with a robust tool that enhances decision-making in the
dynamic stock market environment. By leveraging advanced algorithms and
comprehensive data analysis, the application strives to offer users valuable insights
into potential market trends. Investors can benefit from the model's ability to
process a diverse range of information, enabling them to make informed decisions
about buying, selling, or holding stocks.

The goal is to empower users with a user-friendly and accurate tool that contributes
to more effective and strategic investment choices. As financial markets are
inherently complex and unpredictable, the web application aims to provide a
valuable resource for investors seeking a data-driven approach to navigate the
intricacies of stock price movements.
AIMS AND OBJECTIVES
The project aims to construct an advanced stock price prediction model by
employing artificial intelligence algorithms, specifically Artificial Neural
Networks (ANN) and Random Forest. This model integrates with stock market
chart patterns such as Inverse Head and Shoulder, Double Bottom, and Triple
Bottom, enhancing predictive accuracy. The objective is to provide investors and
traders with refined decision support based on comprehensive analysis of historical
stock data. The model ensures real-time updates, facilitating more informed
decisions in the dynamic stock market environment. Through the synergy of AI
and chart patterns, the project aspires to deliver a precise and timely tool for
investment decision-making.

Objectives:

• Data Collection: Gather historical stock price data, financial news sentiment
data, and relevant market indicators from reliable sources.
• Feature Engineering: Identify and preprocess relevant features such as stock
price history, trading volumes, financial ratios, and market news sentiment
scores.
• Model Selection: Explore various machine learning algorithms and deep
learning techniques to choose the most suitable model for stock price
prediction.
• Training and Validation: Train the selected model on historical data and
validate its performance using appropriate evaluation metrics (e.g., RMSE,
MAE, or accuracy).
• Hyperparameter Tuning: Optimize the hyperparameters of the chosen model
to achieve the best possible prediction accuracy.
• Real-time Data Integration: Implement a mechanism to ingest and process
real-time data, ensuring the model stays up to date with the latest market
information.
• Interpretability: Ensure that the model's predictions can be explained and
interpreted, providing insights into why certain predictions were made.
• Deployment: Deploy the trained model in a production environment where it
can be accessed by users or integrated into trading systems.
• Monitoring and Maintenance: Continuously monitor the model's
performance and retrain it periodically to adapt to changing market
conditions.
• Risk Management: Implement safeguards and risk assessment mechanisms
to mitigate potential financial losses resulting from model predictions.
Review of Existing Models

• The paper “Machine Learning Approach in Stock Market Prediction”


was written by authors Raut Sushrut Deepak, Shinde Isha Uday, Dr D.
Malathi. The paper states that a high level of accuracy and precision are the
key parameters to be considered while predicting the share prices. Time
series analysis, fundamental analysis of companies, technical analysis are
used by many share market individual investors and institutions during the
prediction. However, these methods are not completely reliable, so there is a
need to provide supporting way to predict the stock market. In this paper, a
Machine Learning (ML) method that will be trained in available stock data,
acquire intelligence and use the information obtained to accurately predict.
After extensive research of various algorithms and their robustness in the
various problem domains, the Artificial Neural Network (ANN) was more
appropriate than any other algorithm. The Customized neural network model
which has wide number of features and parameters makes it easier to apply.
An important method used in this paper is to obtain the results of predicting
machine learning concepts and the results tested on the Bombay Stock
Exchange index data set.
• The paper “Stock Market Forecasts Using Machine Learning” was
written by author V.V Kranthi Sai Reddy. The paper states that stock trading
globally is one of the most important. Share market prediction is an attempt
to estimate the future prices of other financial instrument traded on a
currency exchange. This paper describes stock forecasts using Learning
Machines. Technical and basic or time analysis is used by most stockbrokers
when making stock forecasts. The language of the system used to predict the
stock market using Python learning tools. In this paper we propose a
Machine Learning (ML) method that will be trained in available stock data
and gain intelligence and use the information obtained to accurately predict.
In this context the study uses a machine learning system called the Support
Vector Machine to predict the prices of major and minor stocks and three
different markets, using daily and minute wave prices.
• The paper “Stock Closing Price Prediction using Machine Learning
Techniques” was written by authors Mehar Vijh, Deeksha Chandola, Vinay
Anand Tikkiwal and Arun Kumar. Accurate predictions of stock market
returns is a very challenging task due to volatile and non-linear nature of
financial stock markets. This paper describes how Artificial Neural Network
(ANN) and Random Forest techniques are used for predicting the next day
closing price for five companies belonging to different sectors of operation.
The financial data like- Open, High, Low and Close prices of stocks are used
for creating new variables which were used as inputs to the model. The
model is evaluated using strategic indicators – RMSE and MAPE. The
model uses the basic structure of Neural Network having neurons with
different layers. The model works with three layers. It consists of input layer
, hidden layer and the output layer. The input layer consists of new variables
which are H-L, O-C, and 7 DAYS MA, 14 DAYS MA, 21 DAYS MA, 7
DAYS STD DEV and Volume. The hidden layer or the activation layer
consists of these neurons. The total weight is calculated and is moved to the
third layer which is the output layer. Results show that the best values
obtained by ANN model gives RMSE (0.42), MAPE (0.77) . In context the
study uses ANN model to predict the future stock closing price by using
newly created variables - H-L, O-C, and 7 DAYS MA, 14 DAYS MA, 21
DAYS MA, 7 DAYS STD DEV and Volume, as the provided were not
sufficient to predict the precise outcomes.
• The paper “A Survey on Stock Market Prediction Using SVM” was
written by Sachin Sampat Patil, Prof. Kailash Patidar, Asst. Prof. Megha
Jain. This paper worked as one of the foundations in this field of stock price
prediction as it mainly focused on stock price prediction using Support
Vector Machine (SVM) algorithm that has the desirable characteristics of
the control of the decision function, the use of the kernel method, and the
sparsity of the solution. Data used in this process is collected from different
financial markets along the globe and later on different machine learning
algorithms were applied and to predict stock price index and Support Vector
Machine (SVM) algorithm works on the large dataset value which collected
from different global financial markets. Also, SVM does not give a problem
of over fitting. Correlation analysis indicates strong interconnection between
the Market stock index and global markets that close right before or at the
very beginning of trading time. In context, before Artificial Neural Networks
(ANN) Support Vector Machine (SVM) provided significant results and
predicted the numerical up to a decent precision.
Methodology
Our main aim is to create a stock price prediction model that will work on real-
time data and will provide precise closing price of a stock by observing the
previous performance of the stock. To achieve this goal we will be using Artificial
Neural Network (ANN) algorithm on stock constraints such as - High Price, Low
Price, Open Price and Close Price and further new variables will be defined by
deriving these variables to get exact approach at the same time we will be going to
compare the predictive outputs with Stock Market Chart Patterns, in the very
beginning we will be going to design the model that will provide a generalize
output that will be predicted on the basis ANN and Stock Market Chart Patterns
and provide an average predicted value, further other process also be performed
that are listed below-

1. Data Collection:

- Utilize financial APIs, such as Upstox Historical Data API


, to fetch real-time stock data, including historical prices, trading volumes, and
other relevant indicators.

2. Data Preprocessing:

- Clean and preprocess the acquired data, handling missing values and outliers.

- Feature engineering: Extract essential features, calculate technical indicators,


and create lag variables.

3. Model Development:

- Implement an Artificial Neural Network (ANN) model for stock price


prediction using a deep learning framework (e.g., TensorFlow or PyTorch).

- Split the dataset into training and testing sets to evaluate model performance.

4. Training the Model:

- Train the ANN model on the historical stock data, adjusting hyperparameters
and architecture to optimize performance.

- Utilize the closing price as the target variable.


5. Model Evaluation:

- Assess the model's accuracy, precision, and recall on the testing set.

- Implement appropriate evaluation metrics, such as Mean Absolute Error (MAE)


or Root Mean Square Error (RMSE).

6. Integration with Streamlit:

- Develop a web application using the Streamlit framework to create an


interactive and user-friendly interface.

- Integrate the trained ANN model into the Streamlit app for real-time stock price
predictions.

7. User Input and Interaction:

- Allow users to input the stock symbol and choose prediction horizons.

- Display relevant stock information and prediction results in the Streamlit app.

8. Real-Time Data Fetching:

- Implement mechanisms to periodically update the dataset by fetching real-time


stock data using APIs.

- Enable users to access the latest information for accurate predictions.

9. Deployment:

- Deploy the Streamlit web app on cloud platforms like Heroku or AWS for
accessibility to a wider audience.

10. User Testing and Feedback:

- Conduct user testing to gather feedback on the app's functionality and user
experience.

- Iterate on the model and app based on received feedback.


11. Documentation:

- Document the entire process, including data sources, preprocessing steps,


model architecture, and app development, for future reference.

Stock Price Prediction App

Data Collection Data Preprocessing and Feature


(APIs) Engineering

Model Development Streamlit Web App

Model Training and Evaluation Real-Time Data Fetching


(APIs)

Figure 1: Block diagram for Stock Price Prediction Web App


Expected Outcomes
In this project, we will predict closing stock price of any given organization, we
will develop a web application for predicting close stock price using ANN and
other machine learning algorithms for prediction that will work closely with
Stock Chart Patterns and will try to train it upto certain degrees to get the
Optimized outcomes and provide the most accurate predictions for future
closing price of a stock.
• Improved Decision-Making- The primary outcome is to provide investors
and traders with accurate and timely predictions, enabling them to make
more informed decisions about buying, selling, or holding stocks.
• Risk Mitigation- The model should help users better understand and
manage risks associated with stock market investments by identifying
potential price fluctuations and market trends.
• Profit Maximization- Users can aim to maximize their returns by
strategically buying low and selling high based on the model's predictions.
• Reduced Guesswork- The model should reduce the reliance on intuition or
gut feeling in investment decisions, replacing it with data-driven insights.
• Real-time Adaptability- The model can adapt to changing market
conditions and provide updated predictions in real time, helping users stay
current.
• Continuous Improvement- As more data becomes available and the model
is periodically retrained, it should improve its predictive accuracy and adapt
to evolving market conditions.
It's important to note that while a stock market prediction model can offer
valuable insights and benefits, it cannot eliminate all risks associated with
investing. Market conditions can change rapidly, and unforeseen events can
have a significant impact. Therefore, users should use the model's predictions as
one of several factors in their decision-making process and exercise caution
when investing in the stock market.
References
1. Raut Sushrut Deepak, Shinde Isha Uday, Dr. D. Malathi, “Machine Learning
Approach In Stock Market. Prediction”, IJPAM 2017.

2. Reddy, V. Kranthi Sai. "Stock market prediction using machine learning."


International Research Journal of Engineering and Technology (IRJET) 5.10
(2018): 1033-1035.

3. “Stock Closing Price Prediction using Machine Learning Techniques” Mehar


Vijh, Deeksha Chandola, Vinay Anand Tikkiwal and Arun Kumar,167 (2020):
599–606.

4. Sachin Sampat Patil, Prof. Kailash Patidar, Asst. Prof. Megha Jain, “A Survey
on Stock Market Prediction Using SVM '', CTET 2016.

5. https://upstox.com/developer/api-documentation/ - Upstox developers’


documentation

You might also like