04/11/2025
STOCK MARKET TRENDUSING KNN
1
Presented by
1.V. NAGAAKSHAYA (206N1A0521)
2. DONGA JAYA DEEPIKA (206N1A0522)
3. SARILLA HARSHITHA (206N1A0523)
Mr. S.PRABHUDAS
Associate Professor & HOD
Department of CSE
Batch-6
Under the esteemed Guidance of
SRINIVASA INSTITUTE OF ENGINEERING AND TECHNOLOGY
(UGC – Autonomous Institution)
(Approved by AICTE, Permanently affiliated to JNTUK, Kakinada, ISO 9001: 2015 certified Institution)
(Accredited by NAAC with 'A' Grade; Recognised by UGC under sections 2(f) & 12(B))
NH-216, Amalapuram-Kakinada Highway, Cheyyeru (V), AMALAPURAM -533216.
Department of Computer Science and Engineering
2.
04/11/2025 2
Contents
• Abstract
•Objectives
• Introduction
• Literature Survey
• Limitations of Previous Methods
• Proposed Methodology
• Procedure for Implementation
• System Requirements
3.
04/11/2025 3
Abstract
Stock pricesprediction is interesting and challenging research topic. Developed countries' economies are
measured according to their power economy. Currently, stock markets are considered to be an illustrious
trading field because in many cases it gives easy profits with low risk rate of return. Stock market with its
huge and dynamic information sources is considered as a suitable environment for data mining and
business researchers. In this project, we applied k-Nearest Neighbor(KNN) algorithm and non-linear
regression approach. According to the results, the kNN algorithm is robust with small error ratio;
consequently the results were rational and also reasonable. In addition, depending on the actual stock
prices data; the prediction results were close and almost parallel to actual stock prices.
4.
04/11/2025 4
Objectives
Toevaluate the performance of KNN(K-Nearest Neighbor) supervised
machine learning algorithm
To determine the future value of a stock other financial instrument
traded on a financial exchange.
To predict the stock market using machine learning is Python.
5.
04/11/2025 5
Introduction
• Stockmarket is a place where people buy/sell shares of publicly listed companies. It offers a platform to
facilitate seamless exchange of shares.
• Data mining technology is used in analyzing large volume of business and financial data, and it is applied in
order to determine stock movements.
• In stock predictions, a set of pure technical data, fundamental data, and derived data are used in prediction
of future values of stock.
• Combining data mining, classification approaches in stock prediction yields a future value for each
unknown entities of companies’ stocks values based on historical data. This prediction uses various methods
of classification approaches such as neural networks, regression, genetic algorithm, decision tree induction,
and k-Nearest Neighbors (kNN).
6.
04/11/2025 6
Literature Survey
2.1Data Compression Techniques for Stock Market Prediction
• Presents advanced data compression techniques for predicting stock markets behavior under widely accepted
market models in finance.
• The techniques are applicable to technical analysis, portfolio theory, and nonlinear market models.
2.2 Application of K-Nearest Neighbor (KNN) Approach for Predicting Economic Events: Theoretical
Background
In the present study k-Nearest Neighbor classification method, have been studied for economic forecasting.
Due to the effects of companies’ financial distress on stakeholders, financial distress prediction models have
been one of the most attractive areas in financial research.
7.
04/11/2025 7
2.3 AnImproved k-Nearest Neighbor Algorithm for Text Categorization
• k is the most important parameter in a text categorization system based on k-Nearest Neighbor algorithm (kNN).
• In the classification process, k nearest documents to the test one in the training set are determined firstly.
• Then, the predication can be made according to the category distribution among these k nearest neighbors.
2.4 Validation of nearest neighbor classifiers
• This project presents a method to compute probably approximately correct error bounds for k -nearest neighbor
classifiers.
• The method withholds some training data as a validation set to bound the error rate of the holdout classifier that
is based on the remaining training data.
• The result is a bound on the out-of-sample error rate for the classifier based on all training data.
Literature Survey
8.
04/11/2025 8
EXISTING SYSTEM
•There are existing techniques when it comes to stock prediction, some of them are
multispectral prediction, distortion controlled prediction and lempel-ziv based
prediction.
• These are based on the fact that the data representation is more compact by removing
redundancy while the essential information is kept in format that is accessible (Azhar et
al. 1994).
• Due to the scope of the project the techniques that were the most suitable to work with
were the KNN algorithm.
Literature Survey
9.
04/11/2025 9
• Inthis project author is evaluating performance of KNN(K-Nearest Neighbor)
supervised machine learning algorithm.
• In the finance world stock trading is one of the most important activities.
• Stock market prediction is an act of trying to determine the future value of a stock
other financial instrument traded on a financial exchange.
• The programming language is used to predict the stock market using machine learning
is Python. In this project we propose a Machine Learning (ML) approach that will be
trained from the available stocks data and gain intelligence and then uses the acquired
knowledge for an accurate prediction.
• In this context this study uses a machine learning technique called K-Nearest Neighbor
to predict stock prices for the large and small capitalizations and in the three different
markets, employing prices with both daily and up-to-the-minute frequencies.
Proposed Methodology
10.
04/11/2025 10
K-Nearest NeighborAlgorithm
• The K-NN working can be explained on the basis of the below algorithm:
• Step-1: Select the number K of the neighbors
• Step-2: Calculate the Euclidean distance of K number of neighbors
• Step-3: Take the K nearest neighbors as per the calculated Euclidean
distance.
• Step-4: Among these k neighbors, count the number of the data points in
each category.
• Step-5: Assign the new data points to that category for which the number of
the neighbor is maximum.
• Step-6: Our model is ready.
04/11/2025 13
Data FlowDiagram
1. The DFD is also called as bubble chart. It is a simple graphical formalism that can be used to represent a
system in terms of input data to the system, various processing carried out on this data, and the output data is
generated by this system.
2. The data flow diagram (DFD) is one of the most important modeling tools. It is used to model the system
components. These components are the system process, the data used by the process, an external entity that
interacts with the system and the information flows in the system.
3. DFD shows how the information moves through the system and how it is modified by a series of
transformations. It is a graphical technique that depicts information flow and the transformations that are
applied as data moves from input to output.
4. DFD is also known as bubble chart. A DFD may be used to represent a system at any level of abstraction.
DFD may be partitioned into levels that represent increasing information flow and functional detail.
04/11/2025 15
• Beforeselling the securities through stock exchange, the companies have to get their
securities listed in the stock exchange.
• Previously the buying and selling of securities was done in trading floor of stock exchange;
today it is executed through computer and it involves the following steps:
• Trading Procedure on a Stock Exchange: The Trading procedure involves the following
steps:
• 1. Selection of a broker: The buying and selling of securities can only be done through SEBI
registered brokers who are members of the Stock Exchange. The broker can be an
individual, partnership firms or corporate bodies. So the first step is to select a broker who
will buy/sell securities on behalf of the investor or speculator.
• 2. Opening Demat Account with Depository: Demat (Dematerialized) account refer
to an account which an Indian citizen must open with the depository participant
(banks or stock brokers) to trade in listed securities in electronic form. Second step in
trading procedure is to open a Demat account.
Procedure for Implementation
16.
04/11/2025 16
HARDWARE REQUIREMENTS:
System: Pentium Dual Core.
Hard Disk : 120 GB.
Monitor : 15’’ LED
Input Devices : Keyboard, Mouse
Ram : 1 GB
SOFTWARE REQUIREMENTS:
Operating system : Windows 10
Coding Language : python
Tool : PyCharm
Database : MYSQL
Server : Flask
System Requirements
17.
04/11/2025 17
Advantages ofStock Market Prediction
• Stock market prediction aims to determine the future movement of the
stock value of a financial exchange.
• The accurate prediction of share price movement will lead to more profit
investors can make.
• Takes advantage of a growing economy: As the economy
grows, so do corporate earnings. That's because economic
growth creates jobs, which creates income, which creates sales.
• Best way to stay ahead of inflation: Historically, over the long
term stocks have yielded a generous annualized return.
• Easy to buy: The stock market makes it easy to buy shares of
companies.
18.
04/11/2025 18
Applications
Medical Institutions
•To teach medical student how the heart attack been measured, or how
to identify that the person is suffering from heart attack.
Hospitals
• To detect that is the person having heart disease or not.
Business Industries
Shoping Malls
Marts