A Deep Learning Model for Predicting Stock Prices in Tanzania
Received: 24 January 2023 | Revised: 6 February 2023 | Accepted: 16 February 2023 | Online: 2 April 2023
Corresponding author: Samuel Joseph
Abstract
Stock price prediction models help traders to reduce investment risk and choose the most profitable stocks. Machine learning and deep learning techniques have been applied to develop various models. As there is a lack of literature on efforts to utilize such techniques to predict stock prices in Tanzania, this study attempted to fill this gap. This study selected active stocks from the Dar es Salaam Stock Exchange and developed LSTM and GRU deep learning models to predict the next-day closing prices. The results showed that LSTM had the highest prediction accuracy with an RMSE of 4.7524 and an MAE of 2.4377. This study also aimed to examine whether it is significant to account for the outstanding shares of each stock when developing a joint model for predicting the closing prices of multiple stocks. Experimental results with both models revealed that prediction accuracy improved significantly when the number of outstanding shares of each stock was taken into account. The LSTM model achieved an RMSE of 10.4734 when the outstanding shares were not taken into account and 4.7524 when they were taken into account, showing an improvement of 54.62%. However, GRU achieved an RMSE of 12.4583 when outstanding shares were not taken into account and 8.7162 when they were taken into account, showing an improvement of 30.04%. The best model was implemented in a web-based prototype to make it accessible to stockbrokers and investment advisors.
Keywords:
stock price prediction, deep learning, Tanzania, Dar es Salaam stock exchangeDownloads
References
J. Massele, C. Darroux, H. Jonathani, and X. Fengju, "Challenges faced by Dar-es-Salaam Stock Exchange Market in Tanzania," Research Journal of Finance and Accounting, vol. 4, no. 15, pp. 36–43, 2013.
A. Dingli and K. S. Fournier, "Financial Time Series Forecasting – A Deep Learning Approach," International Journal of Machine Learning and Computing, vol. 7, no. 5, pp. 118–122, Oct. 2017. DOI: https://doi.org/10.18178/ijmlc.2017.7.5.632
W. Jiang, "Applications of deep learning in stock market prediction: Recent progress," Expert Systems with Applications, vol. 184, Dec. 2021, Art. no. 115537. DOI: https://doi.org/10.1016/j.eswa.2021.115537
O. Bustos and A. Pomares-Quimbaya, "Stock market movement forecast: A Systematic review," Expert Systems with Applications, vol. 156, Oct. 2020, Art. no. 113464. DOI: https://doi.org/10.1016/j.eswa.2020.113464
B. Labiad, A. Berrado, and L. Benabbou, "Machine learning techniques for short term stock movements classification for Moroccan stock exchange," in 2016 11th International Conference on Intelligent Systems: Theories and Applications (SITA), Mohammedia, Morocco, Jul. 2016. DOI: https://doi.org/10.1109/SITA.2016.7772259
O. Bustos, A. Pomares, and E. Gonzalez, "A comparison between SVM and multilayer perceptron in predicting an emerging financial market: Colombian stock market," in 2017 Congreso Internacional de Innovacion y Tendencias en Ingenieria (CONIITI), Bogota, Colombia, Jul. 2017. DOI: https://doi.org/10.1109/CONIITI.2017.8273335
E. Chong, C. Han, and F. C. Park, "Deep learning networks for stock market analysis and prediction: Methodology, data representations, and case studies," Expert Systems with Applications, vol. 83, pp. 187–205, Oct. 2017. DOI: https://doi.org/10.1016/j.eswa.2017.04.030
"Impact of Stock Market on Economic Growth Evidence: Dar-es Salaam Stock Exchange - Tanzania," Journal of Finance and Accounting, vol. 4, no. 6, pp. 321–327, Nov. 2016. DOI: https://doi.org/10.11648/j.jfa.20160406.12
G. H. Munisi, "Financial Performance of Initial Public Offerings: Companies listed on Dar es Salaam Stock Exchange," Business and Economics Journal, vol. 08, no. 02, 2017. DOI: https://doi.org/10.4172/2151-6219.1000302
"Final Report: Understanding the current state of participation in Tanzania’s capital markets," FinSights Lab, 2020.
B. Labiad, A. Berrado, and L. Benabbou, "Short Term Prediction Framework for Moroccan Stock Market Using Artificial Neural Networks," in Proceedings of the 12th International Conference on Intelligent Systems: Theories and Applications, Rabat, Morocco, Jul. 2018. DOI: https://doi.org/10.1145/3289402.3289520
D. O. Oyewola, A. Ibrahim, Joshua. A. Kwanamu, and E. G. Dada, "A new auditory algorithm in stock market prediction on oil and gas sector in Nigerian stock exchange," Soft Computing Letters, vol. 3, Dec. 2021, Art. no. 100013. DOI: https://doi.org/10.1016/j.socl.2021.100013
M. Nikou, G. Mansourfar, and J. Bagherzadeh, "Stock price prediction using DEEP learning algorithm and its comparison with machine learning algorithms," Intelligent Systems in Accounting, Finance and Management, vol. 26, no. 4, pp. 164–174, 2019. DOI: https://doi.org/10.1002/isaf.1459
Z. Hu, Y. Zhao, and M. Khushi, "A Survey of Forex and Stock Price Prediction Using Deep Learning," Applied System Innovation, vol. 4, no. 1, Mar. 2021, Art. no. 9. DOI: https://doi.org/10.3390/asi4010009
Z. C. Lipton, J. Berkowitz, and C. Elkan, "A Critical Review of Recurrent Neural Networks for Sequence Learning," May 2015.
"Understanding LSTM Networks," Colah’s blog. https://colah.github.io/posts/2015-08-Understanding-LSTMs/.
Y. Yu, X. Si, C. Hu, and J. Zhang, "A Review of Recurrent Neural Networks: LSTM Cells and Network Architectures," Neural Computation, vol. 31, no. 7, pp. 1235–1270, Jul. 2019. DOI: https://doi.org/10.1162/neco_a_01199
M. Obthong, N. Tantisantiwong, W. Jeamwatthanachai, and G. Wills, "A Survey on Machine Learning for Stock Price Prediction: Algorithms and Techniques," presented at the 2nd International Conference on Finance, Economics, Management and IT Business, Prague, Czech Republic, Mar. 2023, pp. 63–71.
A. J. P. Samarawickrama and T. G. I. Fernando, "A recurrent neural network approach in predicting daily stock prices an application to the Sri Lankan stock market," in 2017 IEEE International Conference on Industrial and Information Systems (ICIIS), Peradeniya, Sri Lanka, Sep. 2017. DOI: https://doi.org/10.1109/ICIINFS.2017.8300345
S. K. Lakshminarayanan and J. P. McCrae, "A Comparative Study of SVM and LSTM Deep Learning Algorithms for Stock Market Prediction," in Proceedings for the 27th AIAI Irish Conference on Artificial Intelligence and Cognitive Science, Galway, Ireland, December 5-6, 2019, 2019, vol. 2563, pp. 446–457.
J. Sen, S. Mehtab, A. Dutta, and S. Mondal, "Precise Stock Price Prediction for Optimized Portfolio Design Using an LSTM Model," in 2021 19th OITS International Conference on Information Technology (OCIT), Bhubaneswar, India, Sep. 2021, pp. 210–215. DOI: https://doi.org/10.1109/OCIT53463.2021.00050
J. Sirignano and R. Cont, "Universal features of price formation in financial markets: perspectives from deep learning," Quantitative Finance, vol. 19, no. 9, pp. 1449–1459, Sep. 2019. DOI: https://doi.org/10.1080/14697688.2019.1622295
A. Manishimwe, H. Alexander, H. Kaluuma, and M. A. Dida, "Integrated Mobile Application Based on Machine Learning for East Africa Stock Market," Journal of Information Systems Engineering and Management, vol. 6, no. 3, Jun. 2021, Art. no. em0143. DOI: https://doi.org/10.21601/jisem/11008
U. P. Gurav and S. Kotrappa, "Sentiment Aware Stock Price Forecasting using an SA-RNN-LBL Learning Model," Engineering, Technology & Applied Science Research, vol. 10, no. 5, pp. 6356–6361, Oct. 2020. DOI: https://doi.org/10.48084/etasr.3805
E. S. Saleh and A. M. Kimiagari, "Ranking Tehran’s Stock Exchange Top Fifty Stocks Using Fundamental Indexes and Fuzzy TOPSIS," Engineering, Technology & Applied Science Research, vol. 7, no. 4, pp. 1863–1869, Aug. 2017. DOI: https://doi.org/10.48084/etasr.1252
K. Theofilatos, S. Likothanassis, and A. Karathanasopoulos, "Modeling and Trading the EUR/USD Exchange Rate Using Machine Learning Techniques," Engineering, Technology & Applied Science Research, vol. 2, no. 5, pp. 269–272, Oct. 2012. DOI: https://doi.org/10.48084/etasr.200
"DSE Handbook," Dar es Salaam Stock Exchange PLC, 2016.
J. Chen, "Block Trade: Definition, How It Works, and Example," Investopedia, 2022. https://www.investopedia.com/terms/b/blocktrade.asp.
"Dar Es Salaam Stock Exchange PLC Rules," Dar es Salaam Stock Exchange PLC, 2022.
J. Valacich and C. Schneider, Information Systems Today: Managing the Digital World, 8th ed. London, UK: Pearson, 2017.
"Django introduction - Learn web development." https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Introduction.
Downloads
How to Cite
License
Copyright (c) 2023 Samuel Joseph, Neema Mduma, Devotha Nyambo
This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.