Professional Documents
Culture Documents
---------------------------------------------------------------------***---------------------------------------------------------------------
also plays an significant role in the growth of
the country's industry and commerce, and
ultimately affects the country's economy. Investors
Abstract – and the industry are both involved in the stock
market and want to know if certain stocks will
fluctuate over a certain period of time. The stock
Stock market forecasts have always attracted the market is the main source for any company to
attention of many analysts and researchers. raise capital to expand its business. It is based on
Popular theories hold that the stock market the concept of supply and demand. If the demand
is essentially a random walk and that for the company's stock is higher, the company's
it's a stupid game to try to predict them. stock price goes up, and if the demand
Predicting stock prices is in itself a difficult for the company's stock is low, the company's
problem due to the number of variables involved. stock price goes down.
In the short term, the market acts like a
voting machine, but in the long term it acts like a The National Stock Exchange of India
weighing machine and thus can predict market ( abbreviated as NSE) is the main stock exchange
movements over a longer time frame. Stock Price of India, located in Mumbai. NSE was founded in
prediction’s integration with modern technology – 1992 as the nation's first language-
particularly Machine Learning Algorithm (Quant free electronic exchange. NSE is the first exchange
models as they are referred to in the financial in the country to offer a modern, fully automated
world) is recently becoming a growing topic. screen-based electronic trading system,
Research has shown that Machine Learning providing easy trading facilities for investors
Models particularly with the use of Recursive across the country.
Neural Networks (RNN) and Long-Term Short
Memory (LSTM) when applied to historical data of The main motive to correctly predict stock values
stocks can be used to predict short-term stock and prices in the short and long term is to
prices. Our model applies companies’ projections maximise your potential earnings rather than
as well as sector performances and how the given relying on tips. A great amount of research has
company fares accordingly to correctly predict gone into developing Machine Learning models
stock prices for both short- and long-term goals. that are capable of correctly predicting stock prices
and have been used by hedge funds and investment
Keywords – Stock Price Prediction, Machine banks for quite some time now. However these
Learning, Recursive Neural Networks, Long Short- models are mainly used to predict short term prices
term Memory, Company Projections so that they can be utilised in intraday trading and
most long term models generally focus on indices
and option chains.
1.INTRODUCTION
The efficiency of various prediction models can be
debated as many can’t predict long term
Stock market forecasting and analysis involves fluctuations and compare the current stock value as
attempting to determine the future value of compared to it’s current trading price
a company's stock or other exchange- which takes into account the sector
traded financial instrument. The stock market is a performance(For Eg: The existing share of a stock
very significant part of the country's economy, it let suppose Reliance declines in the Oil Sector as
compared to its projections signalling a down Soheila Abrishami, et al., Economic Time Series
quarter but it’s price value doesn’t fluctuate much Prediction is a sizable task, collected
leading to the assumption that a correction is in attracts the attention of many researchers and is
order which will result in large volumes of shares extremely important to investors.
being sold and the stock price taking a hit). This article focuses on introducing a deep
learning system that uses a series of data about a
Fundamental Analysis refers to concept of using portion of a stock on the NASDAQ stock exchange
underlying financial records published by the to predict a stock's value. This model is trained on
company and taking other competitors’ data and the smallest data for a particular stock and
comparing them to correctly predict the short- and accurately estimates the final value of that stock in
long-term prices. multiple steps. It includes an autoencoder to
remove noise and uses time series data engineering
Due to the involvement of a great number of to provide enhanced features with the original
industries and companies, it contains very features. These new features are fed to the
large datasets from which it is difficult to extract stacked LSTM autoencoder for multi-step estimati
information and analyze their working on of final stock
trends manually. The application developed in this value. Furthermore, this estimate is used under
project, not only helps in prediction the future the profit maximization method to provide support
movement of the stock in the market, but also at the right time to buy and sell a particular stock.
automates the data retrieval, trend analysis, The results indicate that
predictive analysis and insights generation of a the proposed framework outperforms modern time
stock, just at the click of a button. series forecasting methods in terms of analytical
accuracy and efficiency.
Stock market analysis and forecasts will reveal
market trends and predict when to buy stocks. [3] LSTM Method for Bitcoin Price Prediction: A
Successfully predicting the future price of a stock Case Study Stock Market Yahoo Finance, IEEE
can generate substantial profits. This is done using 2019- Ferdiansyah et al., Bit-coin is
large 12-month historical market data in this a cryptocurrency and is currently one of the first.
project, to represent various conditions invest in the stock market. The stock market is very
and confirm that time series models have risky
significant predictive power over Statistical And bitcoin is a cryptocurrency that has been
side for high probability trading and high return for steadily rising in price in recent years,
competitive business investment. sometimes dropping suddenly without knowing if
it had any effect on the stock
market. Automated tools are required to
2. LITERATURE SURVEY predict bitcoin on the stock market due
to its volatility. This study investigates how
[1] Research on Legitimate Neural Network to generate bitcoin stock market prediction mode
Based Stock Price Prediction Method, IEEE 2019 predictions using LSTM. Before confirming
- Sayavong Lounnapha et al. This paper aims the results, the paper tries to measure the results
at a stock price prediction model that focuses on using RMSE (square root squared error). RMSE
complex neural networks with outstanding self- will always be greater than or equal to MAE. The
learning ability. The dataset is taught and RMSE metric evaluates how well the model
tested regarding the behaviors of both the can compute continuous values. The method
cumulative neural network and the Thai stock applied in this study to predict bitcoin on the yahoo
market price predictions. The accuracy financial stock market can
of predictions is high and it can also be promoted forecast results above 12600
in the financial sector. USD in the next two days after the prediction.
3. METHODOLOGY
The model was implemented on Jupiter
Notebooks using python libraries like pandas,
matplotlib, NumPy and yahoo finance. The
objective was to predict stock prices using
numerical, fundamental and sentiment analysis of
companies. The data was first imported from the The P/E ratio can be calculated from the basic
yahoo finance library of share prices which EPS (earnings per share) by taking the current
records all the changes in the stock prices on an price of the stock and dividing it by
interval of 5 minutes as provided by the share’s the earnings received per share. The other measure
stock exchange – NASDAQ, DOW JONES, NIFTY is the price-to-sales ratio, also known as the ratio.
etc. In this particular testing model, we have used Since sales are often referred to as earnings, the
the Microsoft share and we have created the data P/S ratio is also very often referred to as price-to-
frame based on the closing prices of the share earnings or price-to-earnings ratios. . It is mainly
daily and plotted them using matplotlib. A used to measure how much the current market
minmax scaler was then applied onto it for the values that particular stock.
purpose of rescaling all the values in the scale
[0,1] and the reshaped model was then trained This ratio is often used with the well-known P/E
using Long Short-Term Memory and the model ratio to gauge how attractive a company
was then successfully compiled. is compared to its peers. The lower the price-to-
sales ratio, seemingly the more undervalued the
company is, and the more "buy" the
stock qualifies. For example, if company Y has
a price-to-sales ratio of 1.5 times, it can be
argued that company Y is undervalued compared
to company X. Therefore, it makes sense to buy
company Y and sell company X.
While the price-to-sales ratio is a strong investment
metric, it is advisable to only compare it with
similar companies. It makes no sense to compare Fig2 : Closing prices LSTM Model
the price-to-revenue ratio of an oil and gas
company, like Shell, with a technology company,
like Google, because the two
operate in radically different ways. 4. CONCLUSION
The trained model was able to predict closing
prices for the dataset to within 0.93 points of the
closing price and did well in the long-term
predictions as well. The main area where the
prediction was off by a margin was the Covid
crash of 2020 which could not possibly have been
predicted by company values and historical data.
Using the above metrics the data was scaled with
However, to solve this issue – sentiment analysis
the help of a MinMax Scaler and prepped for
can be used on news headlines pertaining to the
testing and the LSTM principles were applied on
stock in question and call/put options can be
the data. The Long-Term Short-Term Memory
provided accordingly.
Network is an advanced form of Recurrent Neural
Network , a sequential network, that allows
information to persist. It can handle the vanishing
gradient problem faced by RNNs. A cyclic neural
network is also known as RNN and is used for
persistent memory. Note for the LSTM
layer, units is the number of LSTM neurons in the
layer. 50 neurons will give the model high
dimensionality, enough to capture the upwards and
downward trends. return_sequences is True as we
need to add another LSTM layer after the current
one. input_shape corresponds to the number of
time stamps and the number of indicators. For
dropout, 20% of 50 neurons will be ignored
randomly during each iteration of training.
Following the above same method, added 2nd, 3rd,
and 4th LSTM layer. The data was then scaled
back to the initial format and the model’s Fig 3: Trained results v actual comparison
predictions were compared with the actual closing
price. 5. REFERENCES
[1] Chiu, D.Y., & Chen, P.J. (2009). Dynamic
exploration of the internal mechanism of the stock
market using fuzzy-based support vector machines
with high-dimensional input spaces and genetic
algorithms. Expert System with App, 36 (2), 1240-
1248.