You are on page 1of 12

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/371125930

Full Paper PREDICTION OF STOCK MARKET RETURNS IN NIGERIA USING


LONG-SHORT TERM MEMORY RECURRENT NEURAL NETWORK MODEL

Conference Paper · May 2023

CITATIONS READS

0 110

3 authors:

Charity Egbunu Terungwa Simon Yange


Federal University of Agriculture JS Tarka University (former Federal University of Agriculture), Makurdi
14 PUBLICATIONS 29 CITATIONS 39 PUBLICATIONS 57 CITATIONS

SEE PROFILE SEE PROFILE

Daniel Jonah Idoko


Kogi State College of Education, Ankpa
1 PUBLICATION 0 CITATIONS

SEE PROFILE

All content following this page was uploaded by Charity Egbunu on 29 May 2023.

The user has requested enhancement of the downloaded file.


Full Paper
PREDICTION OF STOCK MARKET RETURNS IN NIGERIA
USING LONG-SHORT TERM MEMORY RECURRENT NEURAL
NETWORK MODEL

Charity Ojochogwu Egbunu


Department of Computer Science
JS Tarka University, Makurdi ABSTRACT
charityakowe@gmail.com Accurate forecasting of the stock market
returns is a challenging task due to the volatile
Terungwa Simon Yange and nonlinear nature of the stock return values.
Department of Computer Science Prediction of financial time series using
JS Tarka University, Makurdi different models in machine learning and deep
lordesty2k7@ymail.com learning have gained some degree of notable
accuracy. The recurrent neural networks (RNN)
Daniel Jonah Idoko have bases on deep learning with feedback
Department of Computer Sci loops. The cases of gradient vanishing and
JS Tarka University, Makurdi explosion are commonly associated with the
dannyidoks@gmail.com traditional RNNs. The design of LSTM is
intentional in eliminating the problems and this
has made the LSTM to have become famous in
the modelling of data with some complex
sequence. The goal of this research work is to
improve the accuracy of stock market forecasts
using machine learning and classification
algorithms of neural network LSTM. The
historical stock prices data (2nd January, 2014 –
22nd September, 2021) of the selected company
is subjected to the data mining and information
extraction for the purpose of understanding
the hidden patterns and forecast the behavior
trend in the future times. The results reviewed
that the proposed RNN-LSTM outperformed
ANN and Fuzzy-GA models deployed for the
same stock price movements datasets using
MSE and RMSE as 0.1942 to 0.6889/0.7192, and
0.4990 to 0.8300/0.8481 respectively. The
minimal MSE and RMSE obtained shows the
efficacy of the LSTM model in the prediction of
stock market returns

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 237
1. INTRODUCTION simple and straightforward method for solving non-
linear problems such as stock prices; however, their
Stock markets can be compared to the commodity effectiveness is dependent on inappropriate and less
markets. Its traders are individuals or enterprises and appropriate human expert rules being built into the
the customers are shareholders or brokers. The Rule Base and Knowledge Base (Alfa et al., 2020).
purpose for the creation of stock exchange markets is
so that private businesses as well as government The recurrent neural network is good in the
would be assisted for money generation through processing and modeling of sequential data has a
demand and supplies. (Kelotra & Pandey, 2020). unique ability to remember previous state which can
Establishment of stock markets is visible in different be used in the calculation of current state. The hidden
continents and countries of the world and it’s also layers though different, depends on each other and
recognized as asset markets, equity or value. The the input from existing hidden layer includes both the
random behavior of stock spiked the market output from the input layer as well as the output from
hypothesis of the impossibility of predicting stock previously hidden layer. This makes the RNN to handle
values but research analysis with data mining and sequential data very well in terms of performance.
artificial intelligence had shown stock values reflection Another advantage it has is that it considers data
from previous records. Some other factors observed context in the training process which suits the case of
by stock market groups to have effective affluence on stocks and forex understanding the fluctuations at
stock value predictions includes commodity price some point is a kind of linked to preceding trend (Hu
index, political events, commodity price index, general et al., 2021).
economic condition, psychology of investors, other
stock market movements etc. (Nabipour et al., 2020). There are different variations of RNN and the Long
Compared to other areas of forecasting, the stock Short Term Memory (LSTM) is one of such models.
market forecasting can be very tedious (Kelotra & This deep learning model is capable of learning the
Pandey, 2020). As a result of instability in stocks, sequential information, which will help in the analysis
buyers and sellers are often disappointed by these and improve stock prediction performance (Li et al.,
changes which has led to a branch of study called 2020). One of its major contribution is the introduction
prediction of stock index. This type of study focuses of the self-loop design to generate the path of a
mainly on methods and ways of predicting direction of gradient that can flow continuously for an extended
stock price movements in order to effectively decide period of time. In each iteration, the weight of the self-
about possible investment steps that ultimately offers loop is also updated, which solves the gradient
best profit figures (Nabipour et al., 2020). When the vanishing problem that is easily generated when the
future prices of a stock are forecasted correctly, there RNN model updates the weights (Sundermeyer et al.,
are greater chances of maximizing profits on 2012). A time series model is essentially a process of
investments made in the stock exchange markets. At nonlinear parameter fitting. The LSTM model is
present, many attempts have been made at effective at revealing the correlation of a nonlinear
developing tools and methods for predicting stock time series in the delay state space and achieving the
prices and future values such as Neural Nets, goal of stock prediction (He & Droppo, 2016).
Classification techniques, and fuzzy inference systems
(Moghar & Hamiche, 2020). There has been a general This project proposes a deep learning approach of
lack of interest among many stock market participants RNN-based on LSTM for forecasting stock market
or traders in conducting stock transactions because returns There is a need to use deep neural networks to
the majority of forecasting methods are insufficient automatically estimate stock prices at a future date
and inaccurate for revealing significant changes in the with higher accuracy and lower errors. The goal of this
level of price (Thakkar & Chaudhari, 2021; Neenwi et al., study is to create a recurrent neural network based on
2013). As a result, money and share investments are long-short term memory model for predicting stock
improperly withheld from the stock market and the market returns.
country's economy as a whole (Moghar & Hamiche,
2020). Again, there are losses, divestments, poor 2. LITERATURE REVIEW
trading decisions, and general stock market
apprehensions (Nabipour et al., 2020). However, most The stock market is a snapshot of companies' and the
forecasting methods, such as Fuzzy Inference/Experts economy's future growth expectations. the
System, imitate human intelligence to estimate the fluctuation of stock price has been linked to factors
trend (or pattern) of things (or occurrences). By like management trust and operation, economic
definition, fuzzy inference/experts' systems are a factors, market expectancy etc. Technology has
paved easy access for people to use large amount of

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 238
information in a short time and this has made stock their daily decisions in an automated manner from
analysis to become difficult since it requires large data information derived from financial statements.
to be processed. the advancement in big data with
the help of deep learning has however made people Magaji and Adeboye (2014) in their research on
hopeful in stock data analysis (Hu et al., 2021). Correct Nigerian Stock Exchange market used the Artificial
estimation of stock exchange profits investors most Neural Network and found it to be more effective and
(Alotaibi, 2021). In the case of machine learning used efficient in its prediction compared to their previous
for stock price estimations, the learning of such work in an earlier study with same data on which they
models is made possible with actions based on applied the Naïve Bayes and SVM algorithms. In like
knowledge from the past. For situations where a note, a study carried out by Emenike (2010) applied
model may learn outside its domain, such models are the Autoregressive Integrated Moving Average
sure to perform poorly or simply break even. (ARIMA) in modeling and forecasting stock prices in
Apparently, how a model is prepared to work matters the Nigerian Stock Exchange. The performance of the
a lot in the expected performance. In the event that model in prediction was quite poor just as the
prediction of stocks is done on the bases of correlation in the relationship between the NSE index
fundamental analysis in the bid to promote intrinsic and its past. He attributed the deviations to perhaps
security value instead of the market value or if the the global economy crisis as at then. Different
charts for the market value are used, modification of unforeseen factors ranging from the state of the
the model can be done to make it more resilient. economy, politics and insecurity can actually have
Hence, combining technical factors and fundamental effect on the stock exchange market and its
factors would pose as a potential resolution (Singh & prediction. Deep learning however seems to learn
Khushi, 2021). Deep Neural Network (DNN) is a neural from past data and has been quite successful in
network that has at least one hidden layer. It can forecasting and prediction. Idowu et al. (2012) used
model complex nonlinear functions and has a high the multi-layer feed forward neural network and the
level of abstraction, which means that the model's result attested the usefulness of the artificial neural
fitting power is significantly improved. DNN handles network in prediction of stock prices. Stock and
prediction problems that involves large data with foreign currency (Forex) forecasting has always been
nonlinearly mapped relations. Intelligent forecasting a popular and lucrative field of study. In the subject of
of stock and forex prediction can be done with a DNN financial prediction and forecasting, deep learning
(Souma et al., 2019). applications have been shown to produce improved
accuracy and return (Hu et al., 2021).
Mousavi (2021) considering the risk factor that the
poor economic growth coupled with government For comparison and analysis, a survey was conducted
debt could have on time series of stock return applied utilizing articles from the Digital Bibliography &
kernel smoother which is a non-parametric linear Library Project (DBLP) database. Convolutional neural
model, to help to forecast stock returns in long term network (CNN); Long Short-Term Memory (LSTM);
with cross validation determining the smoothing Deep neural network (DNN); Recurrent Neural
parameters and model. The proposed debt -to- price Network (RNN); Reinforcement Learning; Hybrid
ratio and third-to-fourth-quarter economic growth are Attention Networks (HAN); self-paced learning
strong predictors of stock returns, outperforming mechanism (NLP); and Wave net were among the
common variables used for prediction recognized in deep learning methods classified. By presenting a
literatures significantly that explained nearly 30% of stock market prediction method that accurately
the variation in stock returns over a one-year period. anticipates the status of the stock market (Kelotra &
The model must be tested with larger data samples. Pandey, 2020). The prediction module uses the
suggested Rider-based monarch butterfly
Bogdanova & Stancheva-Todorova (2021) stated in optimization (Rider-MBO) technique to train the deep
their work that previous studies focused more on convolutional long short-term memory (Deep-
short-term profitable patterns based on trading ConvLSTM) model. Rider-MBO is a suggested
strategies based on the belief that the best (worst) algorithm that combines the rider optimization
performing securities over the previous short-term algorithm (ROA) and MBO. The data from the live
period tend to perform well (poorly) over the stock market was first subjected to the computation
subsequent period of up to 12 months. Past price of technical indicators, which represented the
patterns and company financial statements assists in features, from which the essential features were
the forecasting of returns from stock market. There extracted through clustering using the Sparse-Fuzzy
is however a need for the development of a C-Means (Sparse-FCM) and feature selection. The
framework which would allow investors to support evaluation was based on six types of live stock market

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 239
data and evaluation criteria such as mean squared state is supplemented by the LSTM cell state, which is
error (MSE) and root mean squared error (RMSE). The identical in dimension to the hidden state vector. You
MSE and RMSE of the model were 7.2487 and 2.6923, can think of an LSTM's cell state as its long-term
respectively. memory and its hidden state as its short-term memory.
Although the information in the cell state can be
Isenah & Olubusoye (2014) in their research on the transferred with little change, the LSTM can change it
application of artificial neural network (ANN) models via gates. An LSTM differs from a typical RNN in that it
in forecasting stock exchange returns compared out- has gates, which control what information in the cell
of-sample forecast prediction with a baseline state should be updated or forgotten. A standard RNN
AutoRegressive Integrated Moving Average (ARIMA) would simply use a hyperbolic tangent function to
model and the ANN outperformed ARIMA modeling update its hidden state for new cells, however LSTMs
forecasting returns. The ARIMA model suitability for require a little more complicated procedure.
stock exchange prediction would be limited even According to a slightly reductionist description, the
though it takes into account the past values and past LSTM employs gates to choose which information in
errors but been that it focuses on dependence of the LSTM cell state should be updated and which
similar trends, limits its ability to selectively pick information should be forgotten before using the
important parts of a sequence and ignore the less updated cell state data to output an updated hidden
important ones. Similarly, Neenwi et al. (2013) also state. The forget gate is the first gate in an LSTM. It is
carried out similar research using ANN in predicting a layer of neurons with a sigmoid activation function
stock exchange in the Nigerian banks and the that receives the input from the LSTM as well as the
simulation results were positive as well. This is previous hidden state and produces a vector with the
because ANN deals with nonlinear problems of which same dimensions as the cell state vector and a range
stock exchange is one. However, in measuring the of 0 to 1 as its output.
continuity in the changes in price trends, the LSTM Output vector from forget gate: →
𝑓𝑡
makes it easy to develop trends using backward Previous hidden state: →
propagation on historic data. ℎ𝑡−1
Current input: 𝑥𝑡
Investigation by researchers on the possibility of Weight vector for forget gate: 𝑊𝑓
increasing profit in stock exchange for investors in Bias for forget gate: 𝐵𝑓
companies considering the effectiveness of the → = 𝜎(→ . [→ ,→ ]+→ )
recurrent neural network in a dispensation where 𝑓𝑡 𝑊𝑓 ℎ𝑡−1 𝑥𝑡 𝐵𝑓

individuals have lost trust in stock exchange The input gate is therefore in doubt following the
prediction has become paramount. The LSTM calculation of the forget gate vector. What fresh data
recurrent neural network model possess the tendency should be used to update a cell's state is decided by
for accurate stock exchange prediction with minimal the input gate. It is made up of two layers of neurons:
forecasting errors due to its ability to utilize data the sigmoid layer and the tanh layer. The tanh layer
stored in previous stage in future prediction tasks. builds a temporary cell state vector with candidates
that can subsequently be used to update the actual
cell state once the sigmoid layer chooses what
3. METHODOLOGY information will be updated.
This section discussed the issues with the current Input gate vector: →
𝑖𝑡
stock market returns prediction with machine learning Candidate cell state values: →
tools. It also discusses how the proposed methods are 𝐶𝑡

deployed to achieved the desired goal. The input gate vector and the candidate cell state is
calculated as such:
3.1 LSTM Model → = 𝜎(→ . [→ , → ] + →)
𝑖𝑡 𝑊𝑓 ℎ𝑡−1 𝑥𝑡 𝐵𝑖
There is a fundamental problem of vanishing gradient
when it comes to RNNs. Though, there are a number → = tan ℎ (→ . [→ ,→ ]+→ )
𝐶𝑡 𝑊𝐶 ℎ𝑡−1 𝑥𝑡 𝐵𝐶
of alternate architectures of RNNs that aim to mitigate It's time to update the old cell state → now that we
𝐶𝑡−1
it, the Long Short-Term Memory (LSTM) architecture
have the input gate output vector, the candidate state,
is the most established and prominent (see Figure 1). A
and the forget gate output vector. We first multiply
cell, a forget gate, an input gate, and an output gate
→ by →. Thus, if a number in the forget gate output
make up the architecture of an LSTM unit. Long-term 𝐶𝑡−1 𝑓𝑡
dependencies can be learned by LSTM networks using vector is 0, the corresponding number in the old cell
these elements, which is particularly intriguing for state is changed to 0 and forgotten, however if the
applications like market prediction. The RNNs' hidden number is 1, the number in the cell state is totally

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 240
preserved. Then, we multiply the candidate cell state → = 𝜎(→ . [→ ,→ ]+→ )
vector by the input gate output vector and add the 𝑜𝑡 𝑊𝑜 ℎ𝑡−1 𝑥𝑡 𝐵𝑜
resulting product to the initial result. → = → ∗ tan ℎ (→ )
ℎ𝑡 𝑜𝑡 𝐶𝑡
The new cell state, →
𝐶𝑡
→ = → ∗→ + →∗ → In this research, the LSTM model above was
𝐶𝑡 𝑓𝑡 𝐶𝑡−1 𝑖𝑡 𝐶𝑡
implemented using python programming language
The output gate, via which we obtain the new hidden with data from Dangote Cement as dataset. We
state ht, is the last component. This state's output is a trained the LSTM neural network to predict whether a
filtered representation of the new cell state. It is made stock’s daily return would be positive or negative the
up of a sigmoid and a tanh layer, just like the input next day for each chosen stock from the dataset. We
gate. Which components of the cell state will remain examined the accuracy, precision, and recall of the
in the output is determined by the sigmoid layer using predictions to judge the caliber of the models the
the input and the prior concealed state. The tanh layer LSTM neural network developed while it performs
is then passed through with the cell state. The final binary classification, a potential positive or negative
result is obtained by multiplying the product of these return.
layers.

Figure 1: Schematic Diagram of LSTM

traded on the Floor Nigerian Stock Exchange from 2nd


January, 2014 to 22nd September, 2021. The data
3.2 Data Collection represented 1911 trading days in which 70% (1337
trading days) served as training dataset, while 30% (573
The data was collected from Dangote Cement trading days) served as testing dataset. The labels and
Company PLC (DANGCEM). It consists of the following details of both datasets are comparable, which are
features: stock closing price, opening price, lowest associated with the daily stock price forecasts from
price and highest price (as presented in Appendix) as DANGCEM. The dataset is mainly composed of

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 241
numerals depicting the various times series of items
Start
and labels.

3.3 System Algorithm


Collect dataset about stock
share prices of a company
The proposed RNN based on LSTM stock price
forecasting model makes use of the previous or
historical data concerning attributes such as share Select the input
closing, share highest price and share opening prices parameters
of a company stock traded on Nigerian Stock market
in order to arrive at an acceptable decision of Select the
upcoming share closing price movements is illustrated hyperparameters for
in Figure 2. the RNN (LSTM)

The step-by-step approach for realizing the proposed


Build the forecasting
forecasting model include:
model

1. The stock share of company historical prices


movements is collected from the Nigeria Stock
No
Exchange Official Archive in Microsoft (CSV)
Train model = Ok?
format.
2. The distinct sets of input parameters are
selected from the historical price movements of Yes
a company stock for preprocessing and model
Apply new data (test
adoption. dataset)
3. The model is formulated using the appropriate
parameters and hyper parameters of RNN
based LSTM.
Evaluate
4. The proposed model formulated in the previous outomes
step is trained using the training dataset
generated earlier.
5. The initial performance of the trained model is Stop
identified and retrained if outcomes are
unsatisfactory.
6. New data is applied to the model using the Figure 2: The proposed system Flowchart.
testing dataset generated in the earlier step.
7. The forecasting model is evaluated using the
appropriate metrics such as MSE, RMSE, MAPE,
etc. 4. RESULTS AND DISCUSSION

The dataset used for this experiment is discussed in


Section 2.2. The learning algorithm employed in this
research used the hyperparameter settings for
purpose of training of the context-specific dataset on
the LSTM. The minimal hyperparameters for model are
provided in Table 1.

Table 1: Minimal Experimental Settings


Hyperparameter Value
Number of convolution 2
layers
Number of max pooling 2
layers
Number of dense layers 4
Dropout rate 0.2
Optimizer Adam

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 242
Activation function Relu 4.1 Trends and Data Exploration
Loss function Binary- The distributions of various data points for the
crossentropy DANGCEM stock prices movements representing the
Number of epochs 100 closing prices, opening prices, highest prices, and
Batch size 64 lowest prices are depicted in the graphics shown in
Simulator Google Figure 3.
Colaboratory
(Google Colab)

Figure 3: The share prices historical data exploration

From Figure 3, the trend in the distribution of share


price values for the closing price and opening price are
similar; because, the prices revealed that the most
rally for the DANGCEM stock returns were in period
between 8th September, 2017 to 17th September, 2019.
In the same vein, the observable trends in the
distribution of share price values for high and low data
points are similar with most rally in the same period as
the close and open prices. The stocks witnessed it
bullish activities on the floor of Nigerian Stock Market
owing to the COVID-19 pandemic and lockdowns of
business activities nationally and internationally.
However, the trends for all the observable parameters
are improving significantly in the current year of
review.

The heat map showing the correlation between the


close, open, high and low share prices for the
DANGCEM stocks are presented in Figure 4.
Figure 4: The Correlation Heatmap Between the Stock Prices
Data.

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 243
From Figure 4, the values of the open and close share negative values do not cancel positive values. The
prices are highly and strongly correlated. While, the smaller the Mean Squared Error, the closer the fit is to
values of the high and low share prices are highly and the data.
strongly correlated.
𝑀𝑒𝑎𝑛 𝑆𝑞𝑢𝑎𝑟𝑒 𝐸𝑟𝑟𝑜𝑟𝑠 (𝑀𝑆𝐸)
4.2 Model Training and Validation 1 𝑛
The relationship between the training loss and = ∑ (𝑡𝑖
𝑛 𝑖=1
validation loss of the proposed stock returns
− 𝑡̂𝑖 )2 (1)
forecasting model is presented in Figure 5.
Root Mean Squared Error: The RMSE as stated in
Equation 2 is just the square root of the mean square
error. RMSE is used for finding the final minimized
errors in forecasted values. This metric shows the
average size of the estimated error in the predicted
value. Simply, we used this metric to measures the
quality of fit between the actual and predicted stock
prices model.

𝑅𝑜𝑜𝑡 𝑀𝑒𝑎𝑛 𝑆𝑞𝑢𝑎𝑟𝑒 𝐸𝑟𝑟𝑜𝑟𝑠 (𝑅𝑀𝑆𝐸)


1 𝑛
= √ ∑ (𝑡𝑖 − 𝑡̂𝑖 )2 (2)
𝑛 𝑖=1

Where:
𝑡𝑖 is the target or actual value of sample
output,
𝑡̂𝑖 is the adjusted or predicted value of sample
Figure 5: The training and validation performances. output,
i is the term index from 1 - n of test data
From Figure 5, the trends of the training loss and sample, and
validation loss are similar across 100 epochs of the n is total number of the test data sample.
model operations. However, training losses were In both cases (MSE and RMSE), the smaller the error
incurred from epochs 0 – 20, while validation losses and the closer the predicted value to zero, then the
were least diminishing from the epoch 0 – 60. This higher the accuracy.
implies the model was effective in learning and
understanding the patterns of the new validation/test 4.2.3 Stock Forecasting Model Outcomes
dataset supplied to it because of the catching or The effectiveness of the proposed stock price
memory inline attribute of LSTM introduced in this forecasting model based on RNN-LSTM was measured
study. Therefore, the stored records of past events using MSE and RMSE evaluation metrics defined by
were used to validate the model. Equations 1 and 2. The summary of the outcomes the
proposed model is presented in Table 2.
4.2.1 Evaluation metrics
Table 2: The proposed model performance.
Mean Squared Error: The MSE as stated in Equation 1
Training Validation
is the average square of the difference between
estimated and actual values. It is a measure of how
close a fitted line is to data points. For every data Epoch MSE RMSE MSE RMSE
point, you take the distance vertically from the point 10. 0.4749 0.6891 0.2718 0.5213
to the corresponding y value on the curve fit (the 20. 0.3626 0.6022 0.2314 0.4810
error), and square the value. Then you add up all those 30. 0.3174 0.5634 0.2176 0.4665
values for all data points, and, in the case of a fit with 40. 0.3005 0.5482 0.2094 0.4576
two parameters such as a linear fit, divide by the 50. 0.2887 0.5373 0.2012 0.4486
number of points minus two. The squaring is done so
International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 244
60. 0.2773 0.5266 0.1958 0.4425 The performance of the proposed model is compared
70. 0.2680 0.5177 0.1944 0.4409 with existing models of forecasting stock prices
80. 0.2615 0.5114 0.1954 0.4420 returns as presented in Table 2.
90. 0.2564 0.5064 0.1974 0.4443
100. 0.2517 0.5017 0.1999 0.4471 Table 2: Stock price returns forecasts compared

The daily and weekly forecasts for the stock price Evaluation Proposed ANN Antecedent
returns for DANGCEM on the basis of proposed model Metric Model Fuzzy-GA
is shown in Figures 6 and 7. (RNN- (Alfa et al.,
LSTM) 2020)
MSE 0.1942 0.6889 0.7192

RMSE 0.4409 0.8300 0.8481

From Table 2, after testing the three models with the


same dataset, the result of the performance metric
used is lower for the proposed model. The Mean
Square error (MSE) and the Root Mean Square Error
(RMSE) respectively are most common performance
metrics used in prediction models, the lower the MSE
or RMSE the higher the accuracy of prediction as there
would be excellent match between the actual and
predicted dataset.
Figure 6: The short-term stock price returns
forecasts. Therefore, in comparison, the proposed model
outperformed the existing ANN and fuzzy-GA models
in predicting stock price returns due to introduction of
memory inline attributes of LSTM and the feedforward
nature of RNN deep neural networks utilized. the
proposed approach for ascertaining the stock market
prices of the companies can be attained effectively.
The graphical representation of these outcomes as
shown in Table 2 are illustrated in Figure 8.

RNN (LSTM) against ANN and


GA-Fuzzy Stock Forecasting
Models
1
Values of metrics

0.8
Figure 7: The long-term stock price returns 0.6
0.4
forecasts. 0.2
0
The distribution curves for the daily and Proposed ANN Fuzzy-GA
Model (RNN-
weekly forecasts reveal that the proposed LSTM)
model performed better for daily forecasts
Stock forecasting models
than the weekly forecasts outcomes
generated. However, in both prediction cases
MSE RMSE
considered, the model was slightly below the
true future values of stock prices. Figure 8: The stock price trends forecasting models
compared.

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 245
5. CONCLUSION Conference on Acoustics, Speech and Signal
Processing (ICASSP), 5445-5449.
This research work is concerned with the stock prices
prediction using the recurrent neural network-based Hu, Z., Zhao, Y., & Khushi, M. (2021). A Survey of Forex
LSTM approach for better accuracy and low error and Stock Price Prediction Using Deep Learning.
rates of outcomes. Based on the results obtained from Applied System Innovation, 4(9), 1–30.
the experiment, the proposed RNN-LSTM Idowu P. A., Osakwe C., Kayode A. A., & Adagunodo E.
outperformed ANN, and Fuzzy-GA models deployed A. (2012). Prediction of Stock Market in Nigeria
for stock price movements forecasts with MSE 0.1942, Using Artificial Neural Network. International
0.6889 and 0.7192 respectively. While, RMSE shows Journal of Intelligent Systems and
0.4990, 0.8300 and 0.8481 for the proposed RNN Applications(IJISA), 4(11), 68-74. DOI:
(LSTM) and ANN and GA-Fuzzy models. There is need 10.5815/ijisa.2012.11.08
to customize the algorithms though to select key
sentences, extract events and identify event
sentiments related to stock markets. LSTM is an Kelotra, A., & Pandey, P. (2020). Stock Market
effective model yet much research attention has not Prediction Using Optimized Deep-ConvLSTM
been given to it. It can be applied in medicine, Model. 8(1), 5–25.
agriculture, weather, transportation and stock trading https://doi.org/10.1089/big.2018.0143
volumes etc. Future studies may hybrid intelligent Li, X., Wu, P., & Wang, W. (2020). Incorporating stock
models, consider more stock exchange markets and prices and news sentiments for stock market
consider the effect of external factors that can prediction: A case of Hong Kong. Information
affluence stock market prediction. Processing and Management, 102212.
https://doi.org/10.1016/j.ipm.2020.102212
REFERENCES
Magaji and Adeboye (2014). An Intense Nigerian Stock
Alfa, A. A., Yusuf, I. O., Misra, S., & Ahuja, R. (2020).
Exchange Market Prediction Using
Enhancing Stock Prices Forecasting System
Outputs Through Genetic Algorithms Logistic with Back-Propagation ANN Model.
Refinement of Rules-Lists. In Lecture Notes in Science World Journal 9(2)
Networks and Systems 121.
https://doi.org/10.1007/978-981-15-3369-3_49 Moghar, A., & Hamiche, M. (2020). Stock Market
Alotaibi, S. S. (2021). Ensemble Technique with Optimal Prediction Using LSTM Recurrent Neural
Feature Selection for Saudi Stock Market Network. Procedia Computer Science, 170, 1168–
Prediction: A Novel Hybrid Red Deer-Grey 1173. https://doi.org/10.1016/j.procs.2020.03.049
Algorithm. IEEE Access, 9, 64929–64944. Mousavi, P. (2021). Debt-by-price ratio, end-of-year
https://doi.org/10.1109/ACCESS.2021.3073507 economic growth, and long-term prediction of
Bogdanova, B., & Stancheva-Todorova, E. (2021). ML- stock returns. Mathematics, 9(13), 1–18.
based predictive modelling of stock market https://doi.org/10.3390/math9131550
returns. AIP Conference Proceedings, Nabipour, M., Nayyeri, P., Jabani, H., Mosavi, A.,
2333(March). https://doi.org/10.1063/5.0042805 Salwana, E., & Shahab, S. (2020). Deep Learning
Emenike K. O. (2010). Forecasting Nigerian Stock for Stock Market Prediction. Entropy, 22, 1–23.
Exchange Returns: Evidence from https://doi.org/https://doi.org/10.3390/e2208084
Autoregressive Integrated Moving Average 0
(ARIMA) Model. Social Science Research Neenwi S., Asagba P. O. and Kabari L. O (2013).
Network. Predicting the Nigerian Stock using Artificial
He, T., & Droppo, J. (2016). Exploiting LSTM structure Neural Network. European Journal of Computer
in deep neural networks for speech recognition. Science and Information. 1(1) 30-39.
In Proceedings of the 2016 IEEE International
Singh, J., & Khushi, M. (2021). Feature learning for

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 246
stock price prediction shows a significant role of Sundermeyer, M., Schlüter, R., & Ney, H. (2012). LSTM
analyst rating. Applied System Innovation, 4(1), 1– neural networks for language modeling. In
17. https://doi.org/10.3390/asi4010017 Proceedings of the Thirteenth Annual
Thakkar, A., & Chaudhari, K. (2021). Fusion in stock Conference of the International Speech
market prediction: A decade survey on the Communication Association, USA, 9-3.
necessity, recent developments , and potential Souma, W., Vodenska, I. and Aoyama, H. (2019)
future directions. Information Fusion, 65, 95–107. Enhanced news sentiment analysis using deep
https://doi.org/10.1016/j.inffus.2020.08.019 learning methods. J. Comput. Soc. Sci. 2, 33–46.
Tuna, G. (2021). Predicting financial market returns in Yange, S. T., Egbunu, C. O., Onyekwere, O. and Foga,
the presence of health crisis: evidence from K. A. (2020). Prediction of Agro Products Sales using
conventional and Islamic stock markets. Regression Algorithm. American Journal of Data Mining
and Knowledge Discovery (AJDMKD), 5(1), 11-19.
Economic Research-Ekonomska Istrazivanja, 1–20.
https://doi.org/10.1080/1331677X.2021.1922089

International Conference on Smart, Secure and Sustainable Nation | S3N’2022 Page 247

View publication stats

You might also like