Deep Learning Algorithm For Stock Price Prediction: 1. Abstract

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Deep Learning algorithm for Stock Price Prediction

Piyush Tiwari1, Amit kumar2, Vipin3,


Prof. Snehal Marathe 4
Army Institute of Technology
Pune, Maharashtra
Department of Electronics and Telecommunication
iampiyush91256@gmail.com, amitkumar_17445@aitpune.edu.in,vipin_17522@aitpune.edu.in,
smarathe@aitpune.edu.in

1. Abstract:
Predicting the stock market has been an area of interest not only for traders but also for the
computer engineers. Predictions can be performed by mainly two means, one by using previous
data available against the stock and the other by analysing the Fundamentals of the stock.
Predictions based on previous data lack accuracy due to changing patterns in the stock market
also, some fields might have been missed due to their insignificance in some stocks or
unavailability of data.
This study, based on the demand for stock price prediction and the practical problems it faces,
compared and analyzed a variety of neural network prediction methods, and finally chose LSTM
(Long Short-Term Memory, LSTM) neural network. 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 behavior. 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 analyzing 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.

2. Introduction :
In Stock Market Prediction, the aim is to predict the future value of the financial stocks of a
company. The recent trend in stock market prediction technologies is the use of machine
learning which makes predictions based on the values of current stock market indices by
training on their previous values. Machine learning itself employs different models to make
prediction easier and authentic. The project focuses on the use of Regression and LSTM based
Machine learning to predict stock values. Factors considered are open, close, low, high and
volume
The vital part of machine learning is the dataset used. The dataset should be as concrete as
possible because a little change in the data can perpetuate massive changes in the outcome. In
this project, supervised machine learning is employed on a dataset obtained from Yahoo
Finance. This dataset comprises of following five variables: open, close, low, high and volume.
Open, close, low and high are different bid prices for the stock at separate times with nearly
direct names. The volume is the number of shares that passed from one owner to another
during the time period. The model is then tested on the test data.

3. Technology Used
LSTM - Long Short-Term Memory (LSTM) is one of many types of Recurrent Neural Network
RNN, it’s also capable of catching data from past stages and use it for future predictions. In
general, an Artificial Neural Network (ANN) consists of three layers:

1) Input layer, 2) Hidden layers, 3) output layer.

An LSTM cell

LSTM Architecture

Long Short Term Memory cells are like mini neural networks designed to allow for memory in a
larger neural network. This is achieved through the use of a recurrent node inside the LSTM cell.
This node has an edge looping back on itself with a weight of one, meaning at every feedfoward
iteration the cell can hold onto information from the previous step, as well as all previous steps.
Since the looping connection’s weight is one, old memories wont fade over time like they would
in traditional RNNs.
LTSMs and recurrent neural networks are as a result good at working with time series data
thanks to their ability to remember the past. By storing some of the old state in these recurrent
nodes, RNNs and LSTMs can reason about current information as well as information the
network had seen one, ten or a thousand steps ago

4. Importing and preparing the data


We have exported the scraped stock data from our scraping server as a .csv file. The dataset
contains n = 41266 minutes of data ranging from April to August 2017 on 500 stocks as well as
the total S&P 500 index price. Index and stocks are arranged in wide format.The data was
already cleaned and prepared, meaning missing stock and index prices were LOCF’ed (last
observation carried forward), so that the file did not contain any missing values.

This is actually the lead of the S&P 500 index, meaning, its value is shifted 1 minute into the
future (this has already been done in the dataset). This operation is necessary since we want to
predict the next minute of the index and not the current minute. Technically speaking, each row
in the dataset contains the price of the S&P500 at t+1 and the constituent’s prices at T=t.

Data scaling

Most neural network architectures benefit from scaling the inputs (sometimes also the output).
Why? Because most common activation functions of the network’s neurons such as tanh or
sigmoid are defined on the [-1, 1] or [0, 1] interval respectively. Nowadays, rectified linear unit
(ReLU) activations are commonly used activations which are unbounded on the axis of possible
activation values. However, we will scale both the inputs and targets anyway. Scaling can be
easily accomplished in Python using MinMaxScaler.

5. RESULTS

The results show us that our algorithm was able to produce outcome satisfactorily and Time
series forecasting is a very intriguing field for any algorithm which is used for prediction of the
time series events.

6. Conclusions
In this experiment, we can also analyze the growth of the shares from different sector and try to find
out which is the best time span for growth of the share. The prediction can be more accurate if the
model will train with a greater number of data set. Moreover, in the case of prediction of various shares,
there may be some scope of specific business analysis. We can study the different pattern of the share
price of different sectors and can analyze a graph with more different time span to fine tune the
accuracy. This framework broadly helps in market analysis and prediction.

7. References
[1] F. a. o. Eugene, "Efficient capital markets: a review of theory and empirical work," Journal of
finance, vol. 25, no. 2, pp. 383-417, 1970.

[2] Z. A. Farhath, B. Arputhamary and L. Arockiam, "A Survey on ARIMA Forecasting Using
Time Series Model," Int. J. Comput. Sci. Mobile Comput, vol. 5, pp. 104-109, 2016.
[3] S. Wichaidit and S. Kittitornkun, "Predicting SET50 stock prices using CARIMA (cross
correlation ARIMA)," in 2015 International Computer Science and Engineering Conference
(ICSEC), IEEE, 2015, pp. 1-4.

[4] D. Mondal, G. Maji, T. Goto, N. C. Debnath and S. Sen, "A Data Warehouse Based
Modelling Technique for Stock Market Analysis," International Journal of Engineering &
Technology, vol. 3, no. 13, pp. 165-170, 2018.

You might also like