Indian Stock Market
Forecasting
Submitted to – Prof. Prashant Thanvi
Presented by – Govind Soni
Table of Contents
▪ Introduction
▪ Literature survey
▪ Methodology
▪ Results
▪ Conclusion
▪ References
▪ Q & A
What is Stock
Stocks are a type of security
that gives stockholders a
share of ownership in a
company. Stocks are also
called as equities.
What is Stock exchange
A stock exchange is a
marketplace where you buy
stocks, bonds, and other
securities. It provides a platform
for companies to sell stocks, and
for investors to trade those
stocks between each other — all
within a regulated space that
aims to make everything as
efficient and transparent as
possible.
History of Stock market
▪ There was a paper trade system
wherein the brokers used to get
records of the price and quantity at
the very inception. The best matches
were made manually.
▪ Security trading in India goes back to
the 18th century when the East
India Company began trading in
loan securities.
▪ Corporate shares started being
traded in the 1830s in Bombay with
the stock of Bank and Cotton
presses.
History of Stock market
• The simple and informal
beginnings of stock exchanges in India
take one back to the 1850s when 22
stockbrokers began trading opposite
the Town Hall of Bombay under a
banyan tree
• The shift continued taking place as the
number of brokers increased, finally
settling in 1874 at what is known
as Dalal Street
• This as yet informal group known as
the Native Share and Stockbrokers
Association organized themselves as
the Bombay Stock Exchange (BSE)
in 1875
Bombay Stock Exchange Limited (BSE)
▪ It is the first stock exchange in India
as well as in Asia, which is located
at Dalal Street, Mumbai.
▪ It was established in 1875
by Premchand Roychand.
▪ World’s 10th largest Stock
Exchange with a market
capitalization of 2,90,42,825.88
crore and has 5294 companies
listed in it.
▪ Index: Sensex (Sensitive Index)
which comprises of 30 companies.
National Stock Exchange of India (NSE)
▪ NSE was incorporated in 1992.
▪ It was recognised as a stock
exchange by SEBI in April 1993 and
commenced operations in 1994
▪ It desisted the monopoly of BSE and
became the first demutualized
electronic exchange in the country
and had a fully-automated screen-
based electronic trading system.
▪ There are 1641 companies listed.
▪ Index: Nifty (National stock exchange
fifty) which comprises of 50
companies.
Key terms
• Stock Symbol – A one to three-
character alphabet root symbol which
represents a company listed on the
exchange.
• Open - Open means the price at which
a stock started trading when the
opening bell rang.
• Close - Close refers to the price of an
individual stock when the stock
exchange closed shop for the day.
• High - The high is the highest price at
which a stock is traded during a period.
• Low - The low is the lowest price of the
period.
Key terms
§ Buy – This means buying shares or taking a position in a company.
§ Sell – Getting rid of the shares as you have achieved your goal or want to
cut down losses.
§ Ask – Ask is what people who are looking to sell their stocks are looking to
get for their shares.
§ Bid – Bid is what you are willing to pay for a stock.
§ Volume - Volumes indicate how many shares are bought and sold over a
given period of time
§ Bull – A bull market is a market condition where investors are expecting
prices to rise.
§ Bear – A bear market is a market condition where investors are expecting
prices to fall.
Deep Learning
Deep learning is a subset
of machine learning, which is
essentially a neural network with
three or more layers. These
neural networks attempt to
simulate the behaviour of the
human brain—albeit far from
matching its ability—allowing it to
“learn” from large amounts of
data.
Types of network architecture
❖Artificial neural network: Used for
modelling nonlinear problems and to
predict the output values for given
input parameters
❖Convolution neural network: Used
for image/object recognition and
classification
❖Recurrent neural network: Used for
Sequence Classification - Sentiment
Classification & Video Classification.
Recurrent Neural Network
RNN is recurrent in nature
as it performs the same
function for every input of
data while the output of
the current input depends
on the past one
computation. For making a
decision, it considers the
current input and the
output that it has learned
from the previous input.
Long Short Term Memory
• LSTMs are a variant of RNN that solve the
Long term memory problem of the former.
• They have a more complex cell
structure than a normal recurrent neuron,
that allows them to better regulate how
to learn or forget efficiently from the
different input sources.
• The key to LSTMs is the cell state (cell
memory), through which the information
flows along and the internal mechanism
called gates that can regulate the flow of
information.
LSTM Architecture
Cell state
• The cell state is sort of
like a conveyor belt that
moves the data along
through the cell.
• The data flowing
through it is altered and
updated according to
the results from the
forget and input gates
and passed to the next
cell.
Forget gate
• This gate removes
unneeded information before
merging with the cell state.
• It takes in 2 inputs, new
information (x_t) and the
previous cells output (h_t-1).
• It runs these inputs through
a sigmoid gate to filter out
unneeded data, and then
merges it with the cell state
via multiplication.
Input gate
• This gate adds information to
the cell state.
• Similar to the forget gate, it
employs a sigmoid gate to
determine what amount of
information needs to be kept.
• It uses the tanh function to
create a vector of the
information to be added.
• It then multiplies the results
from the sigmoid gate and
tanh functions and adds the
useful information to the cell
state using addition.
Output gate
• The last gate selects useful
information based on cell state,
the previous cell output, and new
data.
• It does this by taking the cell
state, after the input and forget
gates have merged, and runs it
through a tanh function to create
a vector.
• It then takes the new data and
previous cell output and runs
them through a sigmoid function
to find what values need to be
outputted.
Stacked LSTM
Bi-directional LSTM
Time series
• A time series is a sequence of data points that occur in
successive order over some period of time.
• Time series are monthly, trimestral, or annual,
sometimes weekly, daily, or hourly (study of road
traffic, telephone traffic), or biennial or decennial.
• Components of time series:
• Secular trend, which describe the movement
along the term.
• Seasonal variations, which represent seasonal
changes.
• Cyclical fluctuations, which correspond to
periodical but not seasonal variations.
• Irregular variations, which are other non-random
sources of variations of series.
Time Series Forecasting
• Time-series forecasting models are the models
that are capable to predict future values based
on previously observed values.
• Time-series forecasting is widely used for non-
stationary data. Non-stationary data are called
the data whose statistical properties e.g. the
mean and standard deviation are not constant
over time but instead, these metrics vary over
time.
• These non-stationary input data (used as input
to these models) are usually called time-series.
Implementation steps
• Raw Stock Price Dataset: Day-wise past stock prices of selected companies
are collected from the NSE(National Stock Exchange) official website using
nsepy library.
• Pre-processing: This step incorporates the following:
▪ Data discretization: Part of data reduction but with particular importance,
especially for numerical data
▪ Data transformation: Normalization.
▪ Data cleaning: Fill in missing values.
▪ Data integration: Integration of data files. After the dataset is transformed
into a clean dataset, the dataset is divided into training and testing sets so as
to evaluate. Creating a data structure with 60 timesteps and 1 output.
Implementation steps
• Feature Selection: In this step, data attributes are chosen that are going to
be fed to the neural network. In this study Date & Close Price are chosen
as selected features.
• Train the NN model: The NN model is trained by feeding the training dataset.
The model is initiated using random weights and biases. Proposed LSTM model
consists of a sequential input layer followed by 3 LSTM layers and then a dense
layer with activation. The output layer again consists of a dense layer with a
linear activation function.
• Output Generation: The RNN generated output is compared with the target
values and error difference is calculated. The Backpropagation algorithm is used
to minimize the error difference by adjusting the biases and weights of the neural
network.
Implementation steps
• Test Dataset Update: Step 2 is repeated for the test data set.
• Error and companies’ net growth calculation: By calculating deviation we
check the percentage of error of our prediction with respect to actual price.
• Visualization: Using Keras and their function APIs the prediction is visualized
• Investigate different time interval: We repeated this process to predict the
price at different time intervals. For our case, we took 2-month dataset as
training to predict 3-month, 6-month, 1 year & 3 years of close price of the share.
In this different time span, we calculate the percentage of error in the future
prediction. This would be different for different sectors. So, this will help to find a
frame for the particular sector to predict future companies’ net growth.
Results
It has been observed from the
result that for almost all the
sectors the error level comes
down drastically with the test
data for longer periods. So we
suggest to apply this LSTM
based model to predict the
share price on long time
historical data.
Conclusions
• We analyse the growth of the companies from
different sector and try to find out which is the best
time span for predicting the future price of the
share.
• This draws an important conclusion that companies
from a certain sector have the same dependencies
as well as the same growth rate. The prediction can
be more accurate if the model will train with a
greater number of data set.
• We can study the different pattern of the share
price of different sectors and can analyse a graph
with more different time span to fine tune the
accuracy
References
▪ https://www.yourarticlelibrary.com/stock-exchange/history-of-stock-exchange-in-
india/23488
▪ https://www.bseindia.com/markets/equity/EQReports/allindiamktcap.aspx
▪ https://www.nseindia.com/national-stock-exchange/history-
milestones#:~:text=NSE%20was%20incorporated%20in%201992,of%20the%20
cash%20market%20segment.
▪ https://wealthdesk.in/blog/the-historical-evolution-of-indian-stock-market/
▪ https://moneymint.com/list-of-stock-exchanges-in-india/
References
• https://www.simplilearn.com/tutorials/deep-learning-tutorial/what-is-
deep-learning
• https://medium.com/analytics-vidhya/long-short-term-memory-
networks-23119598b66b
• https://medium.com/analytics-vidhya/undestanding-recurrent-
neural-network-rnn-and-long-short-term-memory-lstm-
30bc1221e80d
• https://medium.com/analytics-vidhya/exploring-different-types-of-
lstms-6109bcb037c4
References
• https://www.researchgate.net/publication/346450872_Stock_Price_Prediction_
Using_LSTM_on_Indian_Share_Market
• https://towardsdatascience.com/lstm-time-series-forecasting-predicting-stock-
prices-using-an-lstm-model-6223e9644a2f
• https://www.simplilearn.com/tutorials/statistics-tutorial/what-is-time-series-
analysis
• https://www.tableau.com/learn/articles/time-series-analysis
Big Bull of Indian stock market history
Late Harshad Mehta Radhakishan Damani Late Rakesh Jhunjhunwala
Thank you

Seminar.pptx

  • 1.
    Indian Stock Market Forecasting Submittedto – Prof. Prashant Thanvi Presented by – Govind Soni
  • 2.
    Table of Contents ▪Introduction ▪ Literature survey ▪ Methodology ▪ Results ▪ Conclusion ▪ References ▪ Q & A
  • 3.
    What is Stock Stocksare a type of security that gives stockholders a share of ownership in a company. Stocks are also called as equities.
  • 4.
    What is Stockexchange A stock exchange is a marketplace where you buy stocks, bonds, and other securities. It provides a platform for companies to sell stocks, and for investors to trade those stocks between each other — all within a regulated space that aims to make everything as efficient and transparent as possible.
  • 5.
    History of Stockmarket ▪ There was a paper trade system wherein the brokers used to get records of the price and quantity at the very inception. The best matches were made manually. ▪ Security trading in India goes back to the 18th century when the East India Company began trading in loan securities. ▪ Corporate shares started being traded in the 1830s in Bombay with the stock of Bank and Cotton presses.
  • 6.
    History of Stockmarket • The simple and informal beginnings of stock exchanges in India take one back to the 1850s when 22 stockbrokers began trading opposite the Town Hall of Bombay under a banyan tree • The shift continued taking place as the number of brokers increased, finally settling in 1874 at what is known as Dalal Street • This as yet informal group known as the Native Share and Stockbrokers Association organized themselves as the Bombay Stock Exchange (BSE) in 1875
  • 7.
    Bombay Stock ExchangeLimited (BSE) ▪ It is the first stock exchange in India as well as in Asia, which is located at Dalal Street, Mumbai. ▪ It was established in 1875 by Premchand Roychand. ▪ World’s 10th largest Stock Exchange with a market capitalization of 2,90,42,825.88 crore and has 5294 companies listed in it. ▪ Index: Sensex (Sensitive Index) which comprises of 30 companies.
  • 8.
    National Stock Exchangeof India (NSE) ▪ NSE was incorporated in 1992. ▪ It was recognised as a stock exchange by SEBI in April 1993 and commenced operations in 1994 ▪ It desisted the monopoly of BSE and became the first demutualized electronic exchange in the country and had a fully-automated screen- based electronic trading system. ▪ There are 1641 companies listed. ▪ Index: Nifty (National stock exchange fifty) which comprises of 50 companies.
  • 9.
    Key terms • StockSymbol – A one to three- character alphabet root symbol which represents a company listed on the exchange. • Open - Open means the price at which a stock started trading when the opening bell rang. • Close - Close refers to the price of an individual stock when the stock exchange closed shop for the day. • High - The high is the highest price at which a stock is traded during a period. • Low - The low is the lowest price of the period.
  • 10.
    Key terms § Buy– This means buying shares or taking a position in a company. § Sell – Getting rid of the shares as you have achieved your goal or want to cut down losses. § Ask – Ask is what people who are looking to sell their stocks are looking to get for their shares. § Bid – Bid is what you are willing to pay for a stock. § Volume - Volumes indicate how many shares are bought and sold over a given period of time § Bull – A bull market is a market condition where investors are expecting prices to rise. § Bear – A bear market is a market condition where investors are expecting prices to fall.
  • 11.
    Deep Learning Deep learningis a subset of machine learning, which is essentially a neural network with three or more layers. These neural networks attempt to simulate the behaviour of the human brain—albeit far from matching its ability—allowing it to “learn” from large amounts of data.
  • 12.
    Types of networkarchitecture ❖Artificial neural network: Used for modelling nonlinear problems and to predict the output values for given input parameters ❖Convolution neural network: Used for image/object recognition and classification ❖Recurrent neural network: Used for Sequence Classification - Sentiment Classification & Video Classification.
  • 13.
    Recurrent Neural Network RNNis recurrent in nature as it performs the same function for every input of data while the output of the current input depends on the past one computation. For making a decision, it considers the current input and the output that it has learned from the previous input.
  • 14.
    Long Short TermMemory • LSTMs are a variant of RNN that solve the Long term memory problem of the former. • They have a more complex cell structure than a normal recurrent neuron, that allows them to better regulate how to learn or forget efficiently from the different input sources. • The key to LSTMs is the cell state (cell memory), through which the information flows along and the internal mechanism called gates that can regulate the flow of information.
  • 15.
  • 16.
    Cell state • Thecell state is sort of like a conveyor belt that moves the data along through the cell. • The data flowing through it is altered and updated according to the results from the forget and input gates and passed to the next cell.
  • 17.
    Forget gate • Thisgate removes unneeded information before merging with the cell state. • It takes in 2 inputs, new information (x_t) and the previous cells output (h_t-1). • It runs these inputs through a sigmoid gate to filter out unneeded data, and then merges it with the cell state via multiplication.
  • 18.
    Input gate • Thisgate adds information to the cell state. • Similar to the forget gate, it employs a sigmoid gate to determine what amount of information needs to be kept. • It uses the tanh function to create a vector of the information to be added. • It then multiplies the results from the sigmoid gate and tanh functions and adds the useful information to the cell state using addition.
  • 19.
    Output gate • Thelast gate selects useful information based on cell state, the previous cell output, and new data. • It does this by taking the cell state, after the input and forget gates have merged, and runs it through a tanh function to create a vector. • It then takes the new data and previous cell output and runs them through a sigmoid function to find what values need to be outputted.
  • 20.
  • 21.
  • 22.
    Time series • Atime series is a sequence of data points that occur in successive order over some period of time. • Time series are monthly, trimestral, or annual, sometimes weekly, daily, or hourly (study of road traffic, telephone traffic), or biennial or decennial. • Components of time series: • Secular trend, which describe the movement along the term. • Seasonal variations, which represent seasonal changes. • Cyclical fluctuations, which correspond to periodical but not seasonal variations. • Irregular variations, which are other non-random sources of variations of series.
  • 23.
    Time Series Forecasting •Time-series forecasting models are the models that are capable to predict future values based on previously observed values. • Time-series forecasting is widely used for non- stationary data. Non-stationary data are called the data whose statistical properties e.g. the mean and standard deviation are not constant over time but instead, these metrics vary over time. • These non-stationary input data (used as input to these models) are usually called time-series.
  • 24.
    Implementation steps • RawStock Price Dataset: Day-wise past stock prices of selected companies are collected from the NSE(National Stock Exchange) official website using nsepy library. • Pre-processing: This step incorporates the following: ▪ Data discretization: Part of data reduction but with particular importance, especially for numerical data ▪ Data transformation: Normalization. ▪ Data cleaning: Fill in missing values. ▪ Data integration: Integration of data files. After the dataset is transformed into a clean dataset, the dataset is divided into training and testing sets so as to evaluate. Creating a data structure with 60 timesteps and 1 output.
  • 25.
    Implementation steps • FeatureSelection: In this step, data attributes are chosen that are going to be fed to the neural network. In this study Date & Close Price are chosen as selected features. • Train the NN model: The NN model is trained by feeding the training dataset. The model is initiated using random weights and biases. Proposed LSTM model consists of a sequential input layer followed by 3 LSTM layers and then a dense layer with activation. The output layer again consists of a dense layer with a linear activation function. • Output Generation: The RNN generated output is compared with the target values and error difference is calculated. The Backpropagation algorithm is used to minimize the error difference by adjusting the biases and weights of the neural network.
  • 26.
    Implementation steps • TestDataset Update: Step 2 is repeated for the test data set. • Error and companies’ net growth calculation: By calculating deviation we check the percentage of error of our prediction with respect to actual price. • Visualization: Using Keras and their function APIs the prediction is visualized • Investigate different time interval: We repeated this process to predict the price at different time intervals. For our case, we took 2-month dataset as training to predict 3-month, 6-month, 1 year & 3 years of close price of the share. In this different time span, we calculate the percentage of error in the future prediction. This would be different for different sectors. So, this will help to find a frame for the particular sector to predict future companies’ net growth.
  • 27.
    Results It has beenobserved from the result that for almost all the sectors the error level comes down drastically with the test data for longer periods. So we suggest to apply this LSTM based model to predict the share price on long time historical data.
  • 28.
    Conclusions • We analysethe growth of the companies from different sector and try to find out which is the best time span for predicting the future price of the share. • This draws an important conclusion that companies from a certain sector have the same dependencies as well as the same growth rate. The prediction can be more accurate if the model will train with a greater number of data set. • We can study the different pattern of the share price of different sectors and can analyse a graph with more different time span to fine tune the accuracy
  • 29.
    References ▪ https://www.yourarticlelibrary.com/stock-exchange/history-of-stock-exchange-in- india/23488 ▪ https://www.bseindia.com/markets/equity/EQReports/allindiamktcap.aspx ▪https://www.nseindia.com/national-stock-exchange/history- milestones#:~:text=NSE%20was%20incorporated%20in%201992,of%20the%20 cash%20market%20segment. ▪ https://wealthdesk.in/blog/the-historical-evolution-of-indian-stock-market/ ▪ https://moneymint.com/list-of-stock-exchanges-in-india/
  • 30.
    References • https://www.simplilearn.com/tutorials/deep-learning-tutorial/what-is- deep-learning • https://medium.com/analytics-vidhya/long-short-term-memory- networks-23119598b66b •https://medium.com/analytics-vidhya/undestanding-recurrent- neural-network-rnn-and-long-short-term-memory-lstm- 30bc1221e80d • https://medium.com/analytics-vidhya/exploring-different-types-of- lstms-6109bcb037c4
  • 31.
  • 32.
    Big Bull ofIndian stock market history Late Harshad Mehta Radhakishan Damani Late Rakesh Jhunjhunwala
  • 33.