Stok Final 1456
Stok Final 1456
Stok Final 1456
AFFILIATED TO
UNIVERSITY OF MUMBAI
Examiners
1. _________________________
2. __________________________
Supervisor
1. __________________________
______________________________ ____________________________
Date:
Place:
DECLARATION
I declare that this written submission represents my ideas in my own words and where others' ideas or
words have been included, I have adequately cited and referenced the original sources. I also declare
that I have adhered to all principles of academic honesty and integrity and have not misrepresented or
fabricated or falsified any idea/data/fact/source in my submission. I understand that any violation of the
above will be cause for disciplinary action by the Institute and can also evoke penal action from the
sources which have thus not been properly cited or from whom proper permission has not been taken
when needed.
Date:
ACKNOWLEDGEMENT
A mini project is something that could not have been materialized without cooperation of many
people. This project shall be incomplete if I do not convey my heartfelt gratitude to those people from
whom I have got considerable support and encouragement.
It is a matter of great pleasure for us to have a respected Prof. Vivek Pandey as our project guide.
We are thankful to her for being constant source of inspiration.
We would also like to give our sincere thanks to Prof. Mayank Mangal, Head of Department, for
their kind support.
Last but not the least I would also like to thank all the staffs of ARMIET college of Engineering
(Computer Engineering Department) for their valuable guidance with their interest and valuable
suggestions brightened us.
TABLE OF CONTENTS
CH.
TOPIC NAME PAGE NO.
NO
LIST OF FIGURES I
LIST OF TABLES II
ABSTRACT V
1 INTRODUCTION 1
1.1 Motivation 3
1.4 Scope 5
2 LITERATURE SURVEY 6
3 RESEARCH GAP 7
4 RESEARCH OBJECTIVE 8
PROPOSED SYSTEM 14
5 5.1 System Architecture 16
SYSTEM REQUIREMENT 17
6 6.1 Software Requirement 17
SYSTEM DESIGN 20
7 22
7.1 UML Diagram
8 PROJECT IMPLEMENTATION 26
TEST CASES 38
9
9.1 Unit Testing 38
REFERENCES 42
Page |2
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
LIST OF FIGURES
2 System Design 16
3 Home page 17
4 Stock predictor 18
5 Prediction dashboard 18
6 Ticker list 19
I
LIST OF ABBREVIATION
II
LIST OF TABLES
1 Literature Review 8
2 Project Overview 15
III
ABSTRACT
The project aims to predict the prices of a basket of stocks on the NSE/BSE with an acceptable
degree of accuracy. This study, based on the demand for stock price prediction and the practical
problems it faces, compared and analysed a variety of neural network prediction methods, and
finally chose LSTM (Long Short-Term Memory, LSTM) neural network. Then, through in-depth
study on how to predict the stock price by the LSTM, the feasibility of the method and the
applicability of the model are analysed, and finally the conclusion is drawn. It is found that
historical information is very important to investors as the basis of investment decisions. Past
studies have used opening and closing prices as key new predicators of financial markets, but
extreme maxima and minima may provide additional information about future price behaviour.
Therefore, the index of three representative stocks in stock market are selected as the research
objects, and the key data collected from them include the opening price, closing price, lowest price,
highest price, date and daily trading volume. The results show that although LSTM neural network
model has some limitations, such as the time lag of prediction, but with attention layer, it can
predict stock prices. Its main principle is to discover the role of time series through analysing the
historical information of the stock market, and to deeply explore its internal rules through the
selective memory advanced deep learning function of LSTM neural network model, so as to
achieve the prediction of stock price trend.
Keywords: lstm , dataset , neural network , stock , machine learning
IV
Ai Based Share Market Data Prediction Using Python
CHAPTER 1
INTRODUCTION
Page |1
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
INTRODUCTION
1.1 MOTIVATION
Data is used in the forecasting process, particularly in the financial market, as forecasting is used in
the stock market to create an automatic prediction of volatility in share prices. The main purpose of
forecasting by data mining in the stock market is to discover knowledge that can assist decision-
makers. With a successful model for stock prediction, we can gain insight about market behavior over
time, spotting trends that would otherwise not have been noticed. With the increasingly computational
power of the computer, machine learning will be an efficient method to solve this problem.
Predicting how the stock market price will perform is one of the most difficult things to do even
without the use of Machine Learning (ML). There are so many factors involved in the prediction
physical factors vs. psychological, rational and irrational behaviour, etc. All these aspects combine to
make share prices volatile and very difficult to predict with a high degree of accuracy. Stock
investment nowadays is a type of income that most people have, especially the wealthy. It is an income
that is called as portfolio income. An income received from 11 investments, dividends and capital
gains. Unlike earned income, is a type of income that received from jobs or company that you worked
for. Predicting the stock price can ease the work of investors in investing their next company’s stock
of choice. Now, investors of way in predicting the future price of a stock is by doing bunch of analysis
using formulas and they need to calculate by themselves. The analysis could be technical analysis,
P/E Ratio, earnings per share and more. By developing a Machine Learning model, all of that can
easily be automated and calculated by a computer algorithm without the need of having a human
supervision.
Page |2
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
1.4 SCOPE:
This project will help the targeted users to improve their future decision in making more effective
and more accurate and to solve the limitation issues as well in the stock market industry. This
study will be focusing on the investors, financial analyst, economist, businesses, individuals and
as well as finance college student as the users. Hence, the research and development process of
this study will consist of both targeted users and the variety of stock investing platforms and their
features. The details of the scope can be classified into two categories below:
• Targeted Users
Users that will mainly involve with this project’s platform are the users in the business world,
critics, and financial and economy analyst. The users will make use of this project’s dashboard
to make analyst to make their own future decision making process. This dashboard-based
prediction model will have a feature where some finance strategies and decision making will be
Page |3
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
done by Artificial Intelligence (AI) and Machine Learning (ML). This will ease the work of the
analyst out there in making their task for future decision making.
• Development Tools
The proposed development tools for this study will be a Machine Learning algorithm using the
LSTM (Long-Short Term Memory) Neural Network for the analyst of the stock price data and a
simple data scraping technique for extracting the data from the website (yahoo.finance.com). All
the technologies involved will be integrated with each other to make this study a success. The
implementation of the AI and ML technology on the dashboard will be developed via the backend
development of the dashboard with machine learning model and integrated with the data scraping
techniques for the stock data for the ML model to make analysis.
Page |4
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 2
LITERATURE SURVEY
Page |5
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
2. LITERATURE SURVEY
2) Soheila Abrishami(2019) 2 Enhancing Profit by Predicting Stock Prices using Deep Neural
Networks , The prediction of economic time series is quite a herculean task, which has fascinated the
attentiveness of many scholars and is extremely vital for investors. This paper focuses on presenting
a deep learning system, which makes use of a range of facts for a part of the stocks on the NASDAQ
exchange to predict the value of the stock. This model has been trained on the smallest of data for a
particular stock and accurately estimates the concluding value of that stock for multi-step ahead. It
consists of an auto encoder in order to remove noise and makes use of time series data engineering to
syndicate the advanced features with the original features. These new features are given to a Stacked
LSTM Autoencoder for multistep-ahead estimation of the stock concluding value. Further, this
estimation is used by a profit maximization approach to offer assistance on the right time for buying
and selling a particular stock. The results indicate that the suggested framework outclasses the state
of the art time series forecasting methodologies with respect to analytical accuracy and effectiveness.
Page |6
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
Error).The RMSE will at all times be larger or equal to the MAE. The RMSE metric assesses how
well a model can calculate a continuous value. The method that is applied on this research to predict
Bit-coin on the stock market Yahoo finance can forecast the result above $12600 USD for the next
couple of days after prediction
4) Jeevan B et al (2019) on Share Price Prediction using Machine Learning Technique , Lately
stock market has been the talk of the town with more and more people from academics and business
showing interest in it. This paper mostly deals with the approach towards predicting stock prices using
RNN (Recurrent Neural Network) and LSTM (Long Short Term Memory) on National Stock
Exchange using numerous elements such as the present-day market price as well as anonymous events.
A recommendation system along with models constructed on RNN and LSTM methods are used in
selecting the company is also mentioned in this paper.
5) Naadun Siri mevan et al(2020) on Stock Market Prediction Using Machine Learning
Techniques , The Stock Market Prices play a crucial role in today’ economy. Researchers have
discovered that social media platforms such as twitter and web news tend to influence the decision
making process of any individual. In this research behavioural reflex towards web news is taken into
count to reduce the gap and make the prediction much more accurate. Precise predictions
Page |7
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
Page |8
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 3
RESEARCH GAP
Page |9
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
RESEARCH GAP:
Identifying research gaps in stock market prediction is crucial for advancing the field and
improving the accuracy and reliability of predictive models. Here are some potential research
gaps in stock market prediction:
Current models often focus on historical stock data and financial indicators. Research could
explore the integration of non-traditional data sources (e.g., macroeconomic indicators,
geopolitical events, weather data) to better capture market dynamics.
While sentiment analysis is used to gauge market sentiment, there's room to enhance its
integration. Research could delve into improving sentiment analysis techniques and
understanding how sentiment impacts stock prices and trading behavior.
3.Interpretable AI Models:
Many AI models used in stock market prediction, such as neural networks and deep learning,
are often considered black boxes. Research could focus on developing more interpretable AI
models that provide insights into the decision-making process, enhancing trust and
understanding.
Stock markets are inherently non-stationary, making prediction challenging. Research could
focus on developing robust models that can adapt and perform well in non-stationary market
conditions.
Integrating domain expertise and financial knowledge into predictive models could improve
accuracy. Research could explore ways to effectively combine machine learning with domain
expertise for better predictions.
P a g e | 10
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
Volatility is a critical aspect of stock markets. Research could focus on developing models that
accurately quantify and predict market volatility, aiding risk assessment and portfolio
management.
Most models focus on short-term predictions. Research could explore methods for making
reliable long-term stock market predictions, considering the different factors that influence
long-term trends.
Outliers can significantly impact stock prices and predictions. Research could focus on
developing models that are robust to outliers and extreme events, ensuring more stable
predictions.
Research could address the challenges of real-time stock market prediction and high-frequency
trading, aiming to develop models that operate efficiently and effectively in such fast-paced
environments.
Stock market data is often imbalanced and biased. Research could focus on techniques to
handle imbalanced data effectively and mitigate biases that may affect prediction outcomes.
P a g e | 11
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 4
RESEARCH OBJECTIVE
P a g e | 12
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
RESEARCH OBJECTIVE:
Research objectives in the field of stock market prediction should be clear, specific, achievable, and aligned
with the overall goals of the study. Here are potential research objectives for a study on stock market prediction
Design and develop a predictive model using machine learning or statistical methods to forecast
stock prices accurately.
Investigate and implement techniques to improve the accuracy and reliability of the predictive
model for stock market forecasting.
Integrate non-traditional data sources such as social media sentiment, news articles, or economic
indicators to enhance the predictive power of the model.
Analyze and model stock market volatility to provide insights into market dynamics and
fluctuations that impact investment decisions.
Develop algorithms and models to optimize trading strategies based on the predicted stock prices,
aiming for higher returns and reduced risks.
P a g e | 13
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
Assess the accuracy and performance of the model for long-term stock market predictions to aid
investors in making informed decisions for the future.
Investigate the relationship between market sentiment (captured from news, social media) and stock
price movements to enhance sentiment analysis in prediction models.
Explore techniques to handle overfitting and underfitting issues in predictive models, ensuring
the model generalizes well to unseen data.
Assess the robustness of the predictive model against market irregularities, shocks, or financial crises
to determine its stability and reliability in varying market conditions.
Optimize the predictive model for real-time stock market forecasting, aiming to provide timely and
accurate predictions for traders and investors.
P a g e | 14
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 5
PROPOSED SYSTEM
P a g e | 15
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
PROPOSED SYSTEM
The purpose of stock market prediction revolves around leveraging data, analytics, and models to
forecast future price movements in financial markets. This predictive process is driven by a variety of
objectives, each aiming to facilitate informed decision-making and ultimately enhance financial
outcomes for investors, traders, and various stakeholders. Here are the key purposes of stock market
prediction:
1. Risk Management:
Anticipate potential market fluctuations and risks to proactively manage investment portfolios and
reduce financial exposure.
2. Portfolio Optimization:
Optimize investment portfolios by strategically allocating assets based on predicted stock prices
and market trends to achieve higher returns with controlled risk.
Create effective trading strategies by using predictive models to identify optimal entry and exit
points, improving trading outcomes for short-term investors.
Provide data-driven insights to guide investment decisions, assisting investors in selecting the right
stocks or assets based on predicted market movements.
P a g e | 16
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
Aid in long-term financial planning by forecasting stock prices, assisting individuals and
organizations in achieving their financial goals over an extended period.
Analyze and interpret market sentiment by leveraging sentiment analysis techniques, helping in
understanding how public perception affects stock prices and market trends.
Automate trading decisions using predictive models to execute trades in real-time, capitalizing on
short-term market movements and exploiting trading opportunities.
Educate investors about market dynamics, factors influencing stock prices, and the role of
predictive models, promoting a deeper understanding of financial markets.
Drive advancements in machine learning, artificial intelligence, and data analytics through the
development and refinement of predictive models for stock market forecasting.
P a g e | 17
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
P a g e | 18
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 6
SYSTEM REQUIREMENTS
P a g e | 19
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
• Python
• HTML/CSS
• DJANGO
• VS CODE
P a g e | 20
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 7
SYSTEM DESIGN
P a g e | 21
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
P a g e | 22
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 8
PROJECT IMPLEMENTATION
P a g e | 23
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
8.1 RESULT/OUTPUT:.
P a g e | 24
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
P a g e | 25
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CHAPTER 9
TEST CASES
P a g e | 26
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
1. Data Preprocessing:
Validate that the data cleaning function effectively handles missing or erroneous data.
2. Prediction Model:
Validate that the model training function properly trains the prediction model.
3. User Interface:
Validate that the user input handling function correctly processes different input formats.
4. Integration Testing:
P a g e | 27
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
Validate that the data integration function accurately combines and processes data from various
sources.
5. Error Handling:
Validate that the error handling mechanism properly handles invalid input
6. Real-Time Prediction:
Validate that the real-time prediction function produces accurate predictions based on the latest data.
7. Performance Testing:
Validate that the prediction function meets the performance requirements for response time.
P a g e | 28
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
P a g e | 29
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
CONCLUSION
To sum up everything that has been stated, stock market price is difficult to predict still. The reason
is to that, it is a curve which keeps changing and turning on prices from low to high and high to low.
Stock market is manipulated. What it means by that, is that nowadays, you can manipulate the
market by doing simple things like trending on social media.
Recent example, when a group of young people went on Reddit (Social media platform) and ask
their followers to buy a stock from the New York stock exchange so the price of that stock will go
up and eventually they sell all, then the stock is back to its low prices. This is an example how you
can manipulate the stock market.
However, if the stock market is manipulated regularly, a machine can learn from their pattern and
can still predict the stock prices or outcome. Hence, this project’s objectives can still be achieved
as it a machine that learns throughout time.
P a g e | 30
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
FUTURE WORK
Predicting stock market data using AI and Python is a challenging and promising field that continues
to evolve. There are several areas of future work and research you can explore to improve the accuracy
and reliability of AI-based share market data predictions. Here are some key directions you can
consider Advanced Machine Learning Models Explore more advanced machine learning and deep
learning models. Deep learning architectures like recurrent neural networks (RNNs), long short-term
memory (LSTM) networks, and transformers have shown promise in time-series forecasting tasks.
Ensemble Methods Implement ensemble methods to combine predictions from multiple models.
Techniques such as bagging, boosting, and stacking can help improve the overall predictive
performance.
Feature Engineering Investigate novel feature engineering techniques to extract more relevant
information from the data. Feature selection, dimensionality reduction, and domain-specific feature
engineering can be crucial.
Alternative Data Sources Incorporate alternative data sources, such as social media sentiment, news
sentiment, and economic indicators. These can provide valuable information for stock market
prediction.
Apply reinforcement learning techniques to develop trading algorithms that can adapt to changing
market conditions. Reinforcement learning agents can learn to make buy and sell decisions based on
rewards and penalties.
P a g e | 31
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
REFERENCES
P a g e | 32
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY
Ai Based Share Market Data Prediction Using Python
REFERENCES
[2] V. Atanasov, C. Pirinsky, and Q. Wang, “The efficient market hypothesis and
investor behavior,” 2018.
[4] M. Afeef, A. Ihsan, and H. Zada, “Forecasting stock prices through univariate arima
modeling,” 2018.
[5] P.-F. Pai and C.-S. Lin, “A hybrid arima and support vector machines model in stock
price forecasting,” Omega, vol. 33, no. 6, pp. 497–505, 2018.
[6] https://zerodha.com/varsity/
[7] https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-
step-explanation-44e9eb85bf21
[8] "A hybrid stock trading framework integrating technical analysis with machine
learning techniques" by P.K. Singh, G. K. Singh, and S.K. Singh. This paper
explores the integration of technical analysis and machine learning for stock
trading.
P a g e | 33
ALAMURI RATNAMALA INSTITUTE OF ENGINEERING AND TECHNOLOGY