Beyond traditional analysis: Leveraging social media sentiments and market data for nifty50 returns forecasting
Keywords:
Social media, sentiment analysis, deep learning, stock returns, prediction modelAbstract
Researchers across various fields are increasingly focused on the influence of social media networks. In finance and economics, particular attention has been given to the relationship between social media sentiments and stock market returns. This study introduces a robust, high-performance deep learning prediction model, by combining long short-term memory (LSTM) networks with densely connected neural networks (DCNN), to forecast Nifty50 index movements. Notably, this approach integrates data from multiple social media platforms (Twitter, StockTwits, Facebook, and YouTube) for sentiment analysis, combined with market position data—a novel application in this context. Extensive tuning of the model's hyperparameters achieved an accuracy of over 98%, demonstrating the effectiveness of combining social media sentiments with Nifty50 market positions. The resulting model exhibits strong reliability and robustness in forecasting index returns, making it a valuable tool for market forecasting.
References
Aichner, T., Grünfelder, M., Maurer, O., & Jegeni, D. (2021). Twenty-Five Years of Social Media: A Review of Social Media Applications and Definitions from 1994 to 2019. Cyberpsychology, Behavior, and Social Networking, 24(4), 215-222. https://doi.org/10.1089/cyber.2020.0134
Castro, J. W., & Luque, A. J. (2022). The Evolution of the Internet and Social Media: A Literature Review on the Opportunities and Challenges in Organizations. Journal of Business Research, 143, 563-579. Retrieved from https://www.academia.edu/66740790
Chong, E., Han, C. and Park, F.C. (2017) ‘Deep learning networks for stock market analysis and prediction: Methodology, data representations, and case studies’, Expert Systems with Applications, 83, pp. 187–205. Available at: https://doi.org/10.1016/j.eswa.2017.04.030.
Cooke, M. and Buckley, N. (2008) ‘Web 2.0, Social Networks and the Future of Market Research’, International Journal of Market Research, 50(2), pp. 267–292. Available at: https://doi.org/10.1177/147078530805000208.
Coyne, S., Madiraju, P. and Coelho, J. (2018) ‘Forecasting stock prices using social media analysis’, Proceedings - 2017 IEEE 15th International Conference on Dependable, Autonomic and Secure Computing, 2017 IEEE 15th International Conference on Pervasive Intelligence and Computing, 2017 IEEE 3rd International Conference on Big Data Intelligence and Compu, 2018-Janua, pp. 1031–1038. Available at: https://doi.org/10.1109/DASC-PICom-DataCom-CyberSciTec.2017.169.
Dandannavar, P. (2016) ‘Application of Machine Learning Techniques to Sentiment Analysis’, in Conference: 2nd International Conference on Applied and Theoretical Computing and Communication Technology (iCATccT)At: SJBIT, Bengaluru, Kaarnataka, India. Available at: https://doi.org/10.1109/ICATCCT.2016.7912076.
Dang, L.M. and Duong, D. (2016) ‘Improvement methods for stock market prediction using financial news articles’, in 2016 3rd National Foundation for Science and Technology Development Conference on Information and Computer Science , pp. 125–129. Available at: https://doi.org/10.1109/NICS.2016.7725636.
Ding, X. et al. (2015) ‘Deep Learning for Event-Driven Stock Prediction’, in Twenty-Fourth International Joint Conference on Artificial Intelligence, pp. 2327–2333.
Fekrazad, A., Harun, S. M., & Sardar, N. (2022). Social media sentiment and the stock market. Journal of Economics and Finance, 46(2), 397–419. https://doi.org/10.1007/s12197-022-09575-x
Gálvez, R.H. and Gravano, A. (2017) ‘Assessing the usefulness of online message board mining in automatic stock prediction systems’, Journal of Computational Science, 19, pp. 43–56. Available at: https://doi.org/https://doi.org/10.1016/j.jocs.2017.01.001.
Gangopadhyay, S. and Majumder, P. (2023) ‘Text representation for direction prediction of share market’, Expert Systems with Applications, 211, p. 118472. Available at: https://doi.org/https://doi.org/10.1016/j.eswa.2022.118472.
Garg, D. and Tiwari, P. (2021) ‘Impact of social media sentiments in stock market predictions: A bibliometric analysis’, Business Information Review, 38(4), pp. 170–182. Available at: https://doi.org/10.1177/02663821211058666.
Gong, J. and Sun, S. (2009) ‘A New Approach of Stock Price Trend Prediction Based on Logistic Regression Model’, in New Trends in Information and Service Science, 2009. NISS ’09. International Conference on, pp. 1366–1371. Available at: https://doi.org/10.1109/NISS.2009.267.
Garg, D., Tiwari, P., & Jain, V. K. (2025). Do social media sentiments affect investment decisions? A moderated mediation analysis of the relationship between social media sentiments, trust, and investment decisions. Global Business and Economics Review, 32(1), 67-87.
H. Maqsood, I.M.M.M.M.Y.S.A.F.A. et al. , (2020) ‘A local and global event sentiment based efficient stock exchange forecasting using deep learning ’, International Journal of Information Management, 50, pp. 432–451.
Hagenau, M., Liebmann, M. and Neumann, D. (2013) ‘Automated news reading: Stock price prediction based on financial news using context-capturing features’, Decision Support Systems, 55(3), pp. 685–697. Available at: https://doi.org/https://doi.org/10.1016/j.dss.2013.02.006.
Hiransha, M. et al. (2018) ‘NSE Stock Market Prediction Using Deep-Learning Models’, Procedia Computer Science, 132(Iccids), pp. 1351–1362. Available at: https://doi.org/10.1016/j.procs.2018.05.050.
Garg, Deepshi, Pandey, R. K., & Tiwari, P. (2023). A systematic deep learning approach to forecast Nifty50 index trend. 2023 11th International Conference on Intelligent Systems and Embedded Design (ISED).
Jin, Y. (2024). GraphCNNpred: A stock market indices prediction using a Graph based deep learning system. In arXiv [q-fin.CP]. http://arxiv.org/abs/2407.03760
Kaplan, A.M. and Haenlein, M. (2010) ‘Users of the world, unite! The challenges and opportunities of Social Media’, Business Horizons, 53(1), pp. 59–68. Available at: https://doi.org/10.1016/j.bushor.2009.09.003.
Kennedy, H. et al. (2020) ‘Using Predictive Analytics to Measure Effectiveness of Social Media Engagement: A Digital Measurement Perspective’, Measurement in sport marketing [Preprint]
Kim, K. and Han, I. (2000) ‘Genetic algorithms approach to feature discretization in artificial neural networks for the prediction of stock price index’, Expert Systems with Applications, 19(2), pp. 125–132. Available at: https://doi.org/https://doi.org/10.1016/S0957-4174(00)00027-0.
Kim, K., Ryu, D. and Yang, H. (2019) ‘Investor sentiment, stock returns, and analyst recommendation changes: The KOSPI stock market’, Investment Analysts Journal, 48(2), pp. 89–101. Available at: https://doi.org/10.1080/10293523.2019.1614758.
Li, M. et al. (2018) Stock market analysis using social networks, ACSW ’18: Proceedings of the Australasian Computer Science Week Multiconference. Available at: https://doi.org/10.1145/3167918.3167967.
Liu, B. (2012) Sentiment Analysis and Opinion Mining. Morgan & Claypool Publishers.
Liu, H., Wu, L. and Li, X. (Robert) (2019) ‘Social Media Envy: How Experience Sharing on Social Networking Sites Drives Millennials’ Aspirational Tourism Consumption’, Journal of Travel Research, 58(3), pp. 355–369. Available at: https://doi.org/10.1177/0047287518761615.
Long, J. et al. (2020) ‘An integrated framework of deep learning and knowledge graph for prediction of stock price trend: An application in Chinese stock exchange market’, Applied Soft Computing, 91, p. 106205. Available at: https://doi.org/https://doi.org/10.1016/j.asoc.2020.106205.
Long, W., Lu, Z. and Cui, L. (2019) ‘Deep learning-based feature engineering for stock price movement prediction’, Knowledge-Based Systems, 164, pp. 163–173. Available at: https://doi.org/https://doi.org/10.1016/j.knosys.2018.10.034.
López-Cabarcos, M.Á., Piñeiro-Chousa, J. and Pérez-Pico, A.M. (2017) ‘The impact technical and non-technical investors have on the stock market: Evidence from the sentiment extracted from social networks’, Journal of Behavioral and Experimental Finance, 15, pp. 15–20. Available at: https://doi.org/https://doi.org/10.1016/j.jbef.2017.07.003.
Mokhtari, M., Seraj, A., Saeedi, N., & Karshenas, A. (2023). The impact of Twitter sentiments on stock market trends. In arXiv [cs.LG]. http://arxiv.org/abs/2302.07244
M, H. et al. (2018) ‘NSE Stock Market Prediction Using Deep-Learning Models’, Procedia Computer Science, 132, pp. 1351–1362. Available at: https://doi.org/https://doi.org/10.1016/j.procs.2018.05.050.
Malthouse, E.C. et al. (2013) ‘Managing Customer Relationships in the Social Media Era: Introducing the Social CRM House’, Journal of Interactive Marketing, 27(4), pp. 270–280. Available at: https://doi.org/10.1016/j.intmar.2013.09.008.
Nemes, L. and Kiss, A. (2020) ‘Social media sentiment analysis based on COVID-19’, Journal of Information and Telecommunication, 0(0), pp. 1–15. Available at: https://doi.org/10.1080/24751839.2020.1790793.
Nguyen, T.H., Shirai, K. and Velcin, J. (2015) ‘Sentiment analysis on social media for stock movement prediction’, Expert Systems with Applications, 42(24), pp. 9603–9611. Available at: https://doi.org/https://doi.org/10.1016/j.eswa.2015.07.052.
Pan, Y. et al. (2017) ‘A multiple support vector machine approach to stock index forecasting with mixed frequency sampling’, Knowledge-Based Systems, 122, pp. 90–102. Available at: https://doi.org/https://doi.org/10.1016/j.knosys.2017.01.033.
Pandey, R., Mandal, A. and Kumar, A. (2021) ‘Identifying Applications of Machine Learning and Data Analytics Based Approaches for Optimization of Upstream Petroleum Operations’, Energy Technology, 8. Available at: https://doi.org/10.1002/ente.202000749.
Pandey, R.K. et al. (2023) ‘Genetic Algorithm Optimization of Deep Structured Classifier- Predictor Models for Pressure Transient Analysis’, Journal of Energy Resources Technology, Transactions of the ASME, 145(2). Available at: https://doi.org/10.1115/1.4054896.
Pandey, R.K., Kumar, A. and Mandal, A. (2022) ‘A robust deep structured prediction model for petroleum reservoir characterization using pressure transient test data’, Petroleum Research, 7(2), pp. 204–219. Available at: https://doi.org/https://doi.org/10.1016/j.ptlrs.2021.09.003.
Patel, J. et al. (2015) ‘Predicting stock market index using fusion of machine learning techniques’, Expert Systems with Applications, 42(4), pp. 2162–2172. Available at: https://doi.org/https://doi.org/10.1016/j.eswa.2014.10.031.
Renault, T. (2017) ‘Intraday online investor sentiment and return patterns in the U.S. stock market’, Journal of Banking & Finance, 84, pp. 25–40. Available at: https://doi.org/https://doi.org/10.1016/j.jbankfin.2017.07.002.
Salsabila, S. et al. (2023) ‘Aspect-based Sentiment and Correlation-based Emotion Detection on Tweets for Understanding Public Opinion of Covid-19’, Journal of Information Systems Engineering and Business Intelligence, 9, pp. 84–94. Available at: https://doi.org/10.20473/jisebi.9.1.84-94.
Sen, J. and Datta Chaudhuri, T. (2021) ‘A Robust Predictive Model for Stock Price Forecasting’, in Conference on Business Analytics and Intelligence . Available at: https://doi.org/10.36227/techrxiv.16778611.v1.
Shynkevich, Y. et al. (2017) ‘Forecasting price movements using technical indicators: Investigating the impact of varying input window length’, Neurocomputing, 264, pp. 71–88. Available at: https://doi.org/https://doi.org/10.1016/j.neucom.2016.11.095.
Sprenger, T. et al. (2014) ‘Tweets and Trades: the Information Content of Stock Microblogs’, European Financial Management, 20, pp. 926–957. Available at: https://doi.org/10.1111/j.1468-036X.2013.12007.x.
Sul, H.K., Dennis, A.R. and Yuan, L. (Ivy) (2017) ‘Trading on Twitter: Using Social Media Sentiment to Predict Stock Returns’, Decision Sciences, 48(3), pp. 454–488. Available at: https://doi.org/https://doi.org/10.1111/deci.12229.
Sun, T. et al. (2017) ‘Predicting Stock Price Returns Using Microblog Sentiment for Chinese Stock Market’, Proceedings - 2017 3rd International Conference on Big Data Computing and Communications, BigCom 2017, pp. 87–96. Available at: https://doi.org/10.1109/BIGCOM.2017.59.
Sun, X.-Q., Shen, H.-W. and Cheng, X.-Q. (2014) ‘Trading Network Predicts Stock Price’, Scientific Reports, 4(1), p. 3711. Available at: https://doi.org/10.1038/srep03711.
Jishag, A. C., Athira, A. P., Shailaja, M., & Thara, S. (2020). Predicting the stock market behavior using historic data analysis and news sentiment analysis in R. In First International Conference on Sustainable Technologies for Computational Intelligence: Proceedings of ICTSCI 2019 (pp. 717-728). Springer Singapore.
Venkata Malla Reddy, A. (2019) Stock market prediction using RNN and sentiment analysis, International Journal of Advance Research. Available at: www.IJARIIT.com.
Xiong, T. et al. (2015) ‘A combination method for interval forecasting of agricultural commodity futures prices’, Knowledge-Based Systems, 77, pp. 92–102. Available at: https://doi.org/https://doi.org/10.1016/j.knosys.2015.01.002.
Zou, J. et al. (2022) ‘Stock Market Prediction via Deep Learning Techniques: A Survey’. Available at: http://arxiv.org/abs/2212.12717.
Published
How to Cite
Issue
Section
Copyright (c) 2025 Deepshi Garg, Rakesh Kumar Pandey, Prakash Tiwari

This work is licensed under a Creative Commons Attribution 4.0 International License.
Allows users to: distribute and copy the article; create extracts, abstracts, and other revised versions, adaptations or derivative works of or from an article (such as a translation); include in a collective work (such as an anthology); and text or data mine the article. These uses are permitted even for commercial purposes, provided the user: gives appropriate credit to the author(s) (with a link to the formal publication through the relevant URL ID); includes a link to the license; indicates if changes were made; and does not represent the author(s) as endorsing the adaptation of the article or modify the article in such a way as to damage the authors' honor or reputation. CC BY



