Skip to main content

Prediction of Stock Price for Indian Stock Market: A Comparative Study Using LSTM and GRU

  • Conference paper
  • First Online:
Advances in Computing and Data Sciences (ICACDS 2021)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1441))

Included in the following conference series:

Abstract

The dynamic nature of stock markets makes the task of generalizing stock prediction very challenging. The dependence of stock prices upon many parameters which directly or indirectly affect them; just adds to the challenge. In recent years there is an increased interest in stock prediction using neural networks. Most of the work-related are either based upon global exchange parameters or favor one particular architecture. To the best of our knowledge, a dedicated study of Indian stocks and the prediction of their prices are not reported. This is the main motivation of this work.

In this paper, we describe the implementation of the Long Short-Term Memory (LSTM) network, Gated Recurrent Unit (GRU) networks for stock prediction. We present a comparative study as well as an analysis for four different network architectures. We use the NSEpy 0.8 Python package to extract historic data which is made publicly available by NSE India. We have used three years of training data and one-year of testing data. After an in-depth study of the impact of the parameters on the stock prices, we have chosen ten parameters for training. The metric used is the Loss Function. The prediction is performed for the closing prices of stocks of twenty-five Indian companies. The results indicate that a two-layer GRU outperforms all other networks as far as these twenty-five companies are concerned.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. https://en.wikipedia.org/wiki/Bombay_Stock_Exchange. Accessed 21 Feb 2020

  2. https://en.wikipedia.org/wiki/National_Stock_Exchange_of_India. Accessed 21 Feb 2020

  3. Hossain, M.A., Karim, R., Thulasiram, R., Bruce, N.D.B., Wang, Y.: Hybrid deep learning model for stock price prediction. In: 2018 IEEE Symposium Series on Computational Intelligence (SSCI), Bangalore, India, 2018, pp. 1837–1844. https://doi.org/10.1109/SSCI.2018.8628641

  4. Selvin, S., Vinayakumar, R., Gopalakrishnan, E.A., Menon, V.K., Soman, K.P.: Stock price prediction using LSTM, RNN and CNN-sliding window model. In: 2017 International Conference on Advances in Computing, Communications and Informatics (ICACCI), Udupi, pp. 1643–1647 (2017). https://doi.org/10.1109/ICACCI.2017.8126078.

  5. Chung, H., Shin, K.-S.: Genetic algorithm-optimized long short-term memory network for stock market prediction. Sustain. MDPI Open Access J. 10(10), 1–18 (2018)

    Google Scholar 

  6. Liu, Y., Wang, Z., Zheng, B.: Application of regularized GRU-LSTM model in stock price prediction. In: 2019 IEEE 5th International Conference on Computer and Communications (ICCC), Chengdu, China, pp. 1886–1890 (2019). https://doi.org/10.1109/ICCC47050.2019.9064035.

  7. Nabipour, M., Nayyeri, P., Jabani, H., Mosavi, A., Salwana, E., Shahab, S.: Deep learning for stock market prediction. Entropy 22(8), 840 (2020). https://doi.org/10.3390/e220808408.

  8. Istiake Sunny, M.A., Maswood, M.M.S., Alharbi, A.G.: Deep learning-based stock price prediction using LSTM and bi-directional LSTM model. In: 2020 2nd Novel Intelligent and Leading Emerging Sciences Conference (NILES), Giza, Egypt, pp. 87–92 (2020). https://doi.org/10.1109/NILES50944.2020.9257950

  9. Moghar, A., Hamiche, M.: Stock market prediction using LSTM recurrent neural network. Procedia Comput. Sci. 170, 1168–1173 (2020), ISSN 1877-0509. https://doi.org/10.1016/j.procs.2020.03.049.

  10. Chung, J., Gulcehre, C., Cho, K., Bengio, Y.: Empirical evaluation of grated recurrent neural networks on sequence modelling. arXiv:1412.355

  11. Jariwala, S.: Nsepy Documentation (2020). https://nsepy.xyz/. Accessed October 2020

  12. Hochreiter, S., Schmidhuber, J.: Long short-term memory. Neural Comput. 9(8), 1735–1780 (1997)

    Article  Google Scholar 

  13. Understanding LSTM Networks. https://colah.github.io/posts/2015-08-Understanding-LSTMs/. Accessed October 2020

  14. Cho, K., et al.: Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078 (2014)

  15. Deshpande, M.: Advance Recurrent Neural Network. https://pythonmachinelearning.pro/advanced-recurrent-neuralnetworks/. Accessed Dec 2020

  16. Chollet, F., et al.: Keras: deep learning library for Theano and TensorFlow, vol. 7, p. 8 (2015). https://keras.io/k

  17. Kingma, D.P., Ba, J.: Adam: a method for stochastic optimization. arXiv preprint arXiv:1412.6980 (2014)

Download references

Acknowledgment

The authors, thank the department of Electronics and Telecommunication at Fr. Conceicao Rodrigues Institute of Technology for extending support and caring in every aspect for carrying out this work. We would also like to thank the anonymous reviewers whose comments were instrumental in improving the content of this paper.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Megha Kolhekar .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Salimath, S., Chatterjee, T., Mathai, T., Kamble, P., Kolhekar, M. (2021). Prediction of Stock Price for Indian Stock Market: A Comparative Study Using LSTM and GRU. In: Singh, M., Tyagi, V., Gupta, P.K., Flusser, J., Ören, T., Sonawane, V.R. (eds) Advances in Computing and Data Sciences. ICACDS 2021. Communications in Computer and Information Science, vol 1441. Springer, Cham. https://doi.org/10.1007/978-3-030-88244-0_28

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-88244-0_28

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-88243-3

  • Online ISBN: 978-3-030-88244-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics