0% found this document useful (0 votes)
24 views8 pages

Stock Market Analysis

Uploaded by

racingthrottle9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views8 pages

Stock Market Analysis

Uploaded by

racingthrottle9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Int. J. of Mkt. Mgmt.

2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

STOCK MARKET TREND PREDICTION USING KNN


1
Mr.J.VENKATESH,2RACHARLA PAVANI,3ROSHINI MISHRA,4BATHULA
VENKATESH,5SIDDHANTHAM MANISH

1
Assistant Professor,Department Of CSE,Malla Reddy Institute Of Engineering And
Technology(autonomous),Dhulapally,Secundrabad, Telangana, India,[email protected]

2,3,4,5
UG Students,Department Of CSE,Malla Reddy Institute Of Engineering And
Technology(autonomous),Dhulapally,Secundrabad, Telangana, India.

ABSTRACT:

Stock prices prediction 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 algorithm and non-linear regression approach in order to predict stock prices for
a company’s stock data to assist investors, management, decision makers, and users in making
correct and informed investments decisions. This algorithm uses the open, close, high, low
values of a stock in a day and volumes of that stock to train the module. Then for testing, an
opening value of the stock is taken from the user and given as test variable for the module. The
module will return the predicted closing value of that stock. The differences between actual and
predicted closing values of the stock can be interpreted using visualization graph plotted between
those two data. 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.

Key words: KNN, testing stock, stock price data.

I INTRODUCTION stock prices movements which make it


challenging and demanding. Researchers,
Recent business research interests
business communities, and interested users
concentrated on areas of future predictions of
who assume that future occurrence depends
94
Int. J. of Mkt. Mgmt. 2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

on present and past data, are keen to identify data, fundamental data, and derived data are
the stock price prediction of movements in used in prediction of future values of stocks.
stock markets (Kim, 2003). However, The pure technical data is based on previous
financial data is considered as complex data stock data while the fundamental data
to forecast and or predict. Predicting market represents the companies’ activity and the
prices are seen as problematical, and as situation of market. Combining data mining
explained in the efficient market hypotheses classification approaches in stock prediction
(EMH) that was put forward by Fama yields a future value for each unknown
(1990). The EMH is considered as bridging entities of companies’ stocks values based on
the gap between financial information and historical data. This prediction uses various
the financial market; it also affirms that the methods of classification approaches such as
fluctuations in prices are only a result of neural networks, regression, genetic
newly available information; and that all algorithm, decision tree induction, and k-
available information reflected in market Nearest Neighbors (kNN). In classification
prices. The EMH assert that stocks are at all approaches, a data set is divided into training
times in equilibrium and are difficult for data set and testing set. kNN uses similarity
inventors to speculate. Furthermore, it has metrics to compare a given test entity with
been affirmed that stock prices do not pursue the training data set. Each data entity
a random walk and stock prediction needs represents a record with n features. In order
more evidence. Data mining technology is to predict a class label for unknown record,
used in analyzing large volume of business kNN selects k recodes of training data set
and financial data, and it is applied in order that are closest to the unknown records.
to determine stock movements. Mining
2. LITERATURE SURVEY
temporal stock markets is required to provide
additional capabilities required in cases [1] Research on Stock Price Prediction
where the existing data and their interactions Method Based on Convolutional Neural
need to be observed through time dimension. Network, IEEE 2019- Sayavong Lounnapha
In stock predictions, a set of pure technical et al. This paper intends for a prediction

95
Int. J. of Mkt. Mgmt. 2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

model for stock price which is centered at for multi-stepahead. It consists of an auto
the convolutional neural networks, that has encoder in order to remove noise and makes
exceptional capability of learning on its own. use of time series data engineering to
The data set is taught and tested relating the syndicate the advanced features with the
behaviours of both Convolutional Neural original features. These new features are
Networks and Thai stock market The result given to a Stacked LSTM Autoencoder for
shows that the model on grounds of multistep-ahead estimation of the stock
Convolutional Neural Networks can concluding value. Further, this estimation is
effectually recognize the altering trend in used by a profit maximization approach to
stock market price and envisage it which offer assistance on the right time for buying
provides significant allusion for stock price and selling a particular stock. The results
forecast. The accuracy of the prediction is indicate that the suggested framework
found to be elevated, and it could also be outclasses the state of the art time series
promoted in the field of finance. forecasting methodologies with respect to
analytical accuracy and effectiveness.
[2] Enhancing Profit by Predicting Stock
Prices using Deep Neural Networks, IEEE [3]An LSTM-Method for Bit-coin Price
2019-Soheila Abrishami, et al., The Prediction: A Case Study Yahoo Finance
prediction of economic time series is quite a Stock Market, IEEE 2019- Ferdiansyah et
herculean task, which has fascinated the al., Bit-coin is a type of Cryptocurrency and
attentiveness of many scholars and is currently is one of a kind of investment on
extremely vital for investors. This paper the stock market. Stock markets are inclined
focuses on presenting a deep learning by several risks. And bit-coin is one kind of
system, which makes use of a range of facts crypto currency that keeps rising in recent
for a part of the stocks on the NASDAQ years, and sometimes suddenly falls without
exchange to predict the value of the stock. knowing influence on the stock market.
This model has been trained on the smallest There’s a need for automation tools to
of data for a particular stock and accurately predict bit-coin on the stock market because
estimates the concluding value of that stock of its fluctuations. This research study
96
Int. J. of Mkt. Mgmt. 2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

studies how to create mode prediction bit- [5] Stock Market Prediction Using Machine
coin stock market prediction using LSTM. Learning Techniques, IEEE 2020- Naadun
Before confirming the results the paper tries Sirimevan et al., The Stock Market Prices
to measure the results using RMSE (the Root play a crucial role in today’ economy.
Mean Square Error).The RMSE will at all Researchers have discovered that social
times be larger or equal to the MAE. The media platforms such as twitter and web
RMSE metric assesses how well a model can news tend to influence the decisionmaking
calculate a continuous value. The method process of any individual. In this research
that is applied on this research to predict Bit- behavioural reflex towards web news is
coin on the stock market Yahoo finance can taken into count to reduce the gap and make
forecast the result above $12600 USD for the the prediction much more accurate. Precise
next couple of days after prediction. predictions were made for a day, a week and
two weeks here after.
[4] Share Price Prediction using Machine
Learning Technique, IEEE 2019-Jeevan B et 3 METHODOLOGY
al., Lately stock market has been the talk of
We have decided to provide the interface for
the town with more and more people from
the users where they can manually select the
academics and business showing interest in stock data of the company whose market
it. This paper mostly deals with the approach price is to be predicted. Then they can
towards predicting stock prices using RNN generate the vector the data items in that data
(Recurrent Neural Network) and LSTM set using Generate Vector option. After
generating vector, the training of the stock
(Long Short Term Memory) on National
data is done. User can give the opening value
Stock Exchange using numerous elements
whose closing value is to be predicted. Then
such as the present-day market price as well algorithm takes that input as testing variable
as anonymous events. A recommendation and gives to the trained module. Using the
system along with models constructed on kNN algorithm on the given data set and user
RNN and LSTM methods are used in input the machine learning module will
selecting the company is also mentioned in predict the closing value. Then the predicted
value is displayed for the user. A
this paper.
97
Int. J. of Mkt. Mgmt. 2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

visualization graph is used to report the • It is also called a lazy learner


effectiveness of the algorithm used. algorithm because it does not learn
from the training set immediately
How Does kNN Algorithm Works:
instead it stores the dataset and at the
• K-Nearest Neighbour is one of the time of classification, it performs an
simplest Machine Learning action on the dataset.
algorithms based on Supervised
• KNN algorithm at the training phase
Learning technique.
just stores the dataset and when it
• K-NN algorithm assumes the gets new data, then it classifies that
similarity between the new case/data data into a category that is much
and available cases and put the new similar to the new data.
case into the category that is most
4 RESULTS EXPLANATION
similar to the available categories.

• K-NN algorithm stores all the


available data and classifies a new
data point based on the similarity.
This means when new data appears
then it can be easily classified into a
well suite category by using K- NN
algorithm.
Fig.4.1. Admin page.
• K-NN algorithm can be used for
Regression as well as for
Classification but mostly it is used
for the Classification problems.

• K-NN is a non-parametric
algorithm, which means it does not
make any assumption on underlying
data.
Fig.4.2. Uploading Data Set.

98
Int. J. of Mkt. Mgmt. 2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

Stock market prediction is a very difficult


task because of the volatile nature of the
movement of financial share data for sectors
and companies in the stock market. The ideal
solution for achieving efficient and accurate
forecasting is employing artificial
intelligence in applying machine learning
techniques. The kNN-algorithm used in this
Fig.4.3. Generate vector. project gave the effective results. According
to the results, kNN algorithm was stable and
robust with small error ratio, so the results
were rational and reasonable. In addition,
depending on the actual stock prices data;
the prediction results were close to actual
prices. Having such rational results for
predictions in specific, and for using data
mining techniques in real life; this presents a
good indication that the use of data mining
Fig.4.4. Data Visualization.
techniques could help decision makers at
various levels when using kNN for data
analysis. So, we consider that employing this
prediction model, kNN is real and viable for
stock predictions.

REFERANCES

[1] Khedr, Ayman E., and Nagwa Yaseen.


"Predicting stock market behavior using data
mining technique and news sentiment
Fig.4.5. Actual vs Predicted Visualization.
analysis." International Journal of Intelligent
CONCLUSION Systems and Applications 9.7, pp. 22.
(2017).

99
Int. J. of Mkt. Mgmt. 2024

ISSN 2454-5007, www.ijmm.net

Vol. 16, Issue. 2, April 2024

[2] Chittineni, Suresh, et al. "A Comparative Review and Taxonomy of Prediction
Study of CSO and PSO Trained Artificial Techniques." International Journal of
Neural Network for Stock Market Financial Studies, 7.2, pp. 26 (2019).
Prediction." International Conference on
[8] Alkhatib, Khalid, et al. "Stock price
Computational Science, Engineering and
prediction using k-nearest neighbor (kNN)
Information Technology. Springer, Berlin,
algorithm." International Journal of
Heidelberg,pp. 186-195,2011.
Business, Humanities and Technology 3.3,
[3] M. Kumari and S. Godara, “Comparative pp. 32-44, (2013).
Study of Data Mining Classification
[9] Farshchian, Maryam, and Majid Vafaei
Methods in Cardiovascular Disease
Jahan. "Stock market prediction with hidden
Prediction”, IJCST ISSN: 2229- 4333, vol. 2,
markov model." 2015 International Congress
no.2, (2011).
on Technology, Communication and
[4] Khalid, Balar, and Naji Abdelwahab. Knowledge (ICTCK). IEEE, 2015.
"Big Data and Predictive Analytics:
[10] BhaveshPatankar and Dr. Vijay Chavda,
Application in Public Health Field.”,
“A Comparative Study of Decision Tree,
International Journal of Computer Science
Naive Bayesian and k-nn Classifiers in Data
and Information Technology & Security
Mining”, International Journal of Advanced
(IJCSITS), Vol6, No.5, 2016.
Research in Computer Science and Software
[5] S.Archana and Dr. K.Elangovan, “Survey Engineering, Vol. 4, Issue 12, December
of Classification Techniques in Data 2014.
Mining”, International Journal of Computer
Science and Mobile Applications, Vol. 2
Issue. 2, February 2014.

[6] Nyce, Charles. "Predictive Analytics


White Paper, sl: American Institute for
Chartered Property Casualty Underwriters."
Insurance Institute of America, p.1, (2007).

[7] Shah, Dev, Haruna Isah, and Farhana


Zulkernine. "Stock Market Analysis: A

100

You might also like