Stock Price Prediction Using LSTM and XGBoost with Social Media Sentiment
Abstract
The influence of social media on financial markets is growing and motivates research on the predictive role of sentiment in stock price movements. Bank Negara Indonesia (BBNI) is part of the Danantara holding company, and BBNI's strategic position is an important indicator for measuring the performance of the broader financial ecosystem in Indonesia. This study analyzes the influence of social media sentiment on the stock price prediction of Bank Negara Indonesia (BBNI), which is part of the state-owned holding company Danantara. Historical market data is combined with sentiment indicators obtained from public conversations on X/Twitter. Daily sentiment features are then integrated with market variables, including OHLCV data, to form a combined dataset. Two machine learning approaches were employed: Long Short-Term Memory (LSTM) and Extreme Gradient Boosting (XGBoost). The results revealed contrasting patterns between the two models. The LSTM Baseline consistently produced RMSE around (≈46–65) across all scenarios. However, XGBoost-Extended is the best-performing and recommended model for sentiment-integrated prediction with RMSE (≈30–40).
Downloads
References
A. Bagheffar and C. Saous, “The Impact of Investor Sentiment on Stock Returns in the Indonesian Stock Market: An Econometric Study,” Finance and Business Economics Review, vol. 7, pp. 166–183, Dec. 2023.
G. Liu, Y. Yang, W. Mo, W. Gu, and R. Wang, “Private Placement, Investor Sentiment, and Stock Price Anomaly,” Journal of Advanced Computational Intelligence and Intelligent Informatics, vol. 27, no. 5, pp. 771–779, Sep. 2023, doi: 10.20965/jaciii.2023.p0771.
D. Choi, C. J. Shallue, Z. Nado, J. Lee, C. J. Maddison, and G. E. Dahl, “On Empirical Comparisons of Optimizers for Deep Learning,” Jun. 2020, [Online]. Available: http://arxiv.org/abs/1910.05446
J. M. Simanjuntak and K. N. Widyadhana, “Danantara, the SOE Superholding, and the Pillar of Indonesia’s Economic Future?,” International Journal of Economics Development Research, vol. 6, no. 4, pp. 1777–1796, Jun. 2025.
P. Patel, “Real-Time Sentiment Analysis of Twitter Streams for Stock Forecasting,” International Journal of Computer Trends and Technology, vol. 72, no. 5, pp. 204–209, May 2024, doi: 10.14445/22312803/ijctt-v72i5p125.
M. Mokhtari, A. Seraj, N. Saeedi, and A. Karshenas, “The Impact of Twitter Sentiments on Stock Market Trends,” Isfahan University of Technology, Isfahan, Iran, 2023.
J. Bollen, H. Mao, and X. Zeng, “Twitter mood predicts the stock market,” J Comput Sci, vol. 2, no. 1, pp. 1–8, Mar. 2011, doi: 10.1016/j.jocs.2010.12.007.
Z. Li, “The Impact of Social Media Sentiment on Stock Price Changes,” Advances in Economics, Management and Political Sciences, vol. 170, no. 1, pp. 49–59, Jun. 2025, doi: 10.54254/2754-1169/2025.lh23972.
N. P. I. Maharani, Y. Yustiawan, F. C. Rochim, and A. Purwarianti, “Domain-Specific Language Model Post-Training for Indonesian Financial NLP,” Oct. 2023, [Online]. Available: http://arxiv.org/abs/2310.09736
H. Zolfagharinia, M. Najafi, S. Rizvi, and A. Haghighi, “Unleashing the Power of Tweets and News in Stock-Price Prediction Using Machine-Learning Techniques,” Algorithms, vol. 17, no. 6, Jun. 2024, doi: 10.3390/a17060234.
T. Fischer and C. Krauss, “Deep Learning with Long Short-Term Memory Networks for Financial Market Predictions,” Eur J Oper Res, vol. 270, no. 2, pp. 654–669, Oct. 2018, doi: 10.1016/j.ejor.2017.11.054.
H. N. Bhandari, B. Rimal, N. R. Pokhrel, R. Rimal, K. R. Dahal, and R. K. C. Khatri, “Predicting stock market index using LSTM,” Machine Learning with Applications, vol. 9, p. 100320, Sep. 2022, doi: 10.1016/j.mlwa.2022.100320.
E. Arif, S. Suherman, and A. P. Widodo, “Predicting Stock Prices of Digital Banks: A Machine Learning Approach Combining Historical Data and Social Media Sentiment from X,” Ingenierie des Systemes d’Information, vol. 30, no. 3, pp. 687–701, Mar. 2025, doi: 10.18280/isi.300313.
M. Roondiwala, H. Patel, and S. Varma, “Predicting Stock Prices Using LSTM,” International Journal of Science and Research, vol. 6, Apr. 2017, [Online]. Available: https://www.quandl.com/data/NSE
M. L. Thormann, J. Farchmin, C. Weisser, R. M. Kruse, B. Safken, and A. Silbersdorff, “Stock Price Predictions with LSTM Neural Networks and Twitter Sentiment,” Statistics, Optimization and Information Computing, vol. 9, no. 2, pp. 268–287, 2021, doi: 10.19139/soic-2310-5070-1202.
N. Afrianto, D. H. Fudholi, and S. Rani, “Prediksi Harga Saham Menggunakan BiLSTM dengan Faktor Sentimen Publik,” Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), vol. 6, no. 1, pp. 41–46, Feb. 2022, doi: 10.29207/resti.v6i1.3676.
S. M. Rezaeinia, R. Rahmani, A. Ghodsi, and H. Veisi, “Sentiment analysis based on improved pre-trained word embeddings,” Expert Syst Appl, vol. 117, pp. 139–147, Mar. 2019, doi: 10.1016/j.eswa.2018.08.044.
E. Ria Devina, “Sentiment Analysis between VADER and EDA for the US Presidential Election 2020 on Twitter Datasets,” Journal of Applied Data Sciences, vol. 2, no. 1, pp. 8–18, 2021.
Y. Al Amrani, M. Lazaar, and K. E. El Kadirp, “Random forest and support vector machine based hybrid approach to sentiment analysis,” in Procedia Computer Science, Elsevier B.V., 2018, pp. 511–520. doi: 10.1016/j.procs.2018.01.150.
J. Z. G. Hiew, X. Huang, H. Mou, D. Li, Q. Wu, and Y. Xu, “BERT-based Financial Sentiment Index and LSTM-based Stock Return Predictability,” arXiv preprint arXiv:1906.09024, Jun. 2019, [Online]. Available: http://arxiv.org/abs/1906.09024
J. S. Saltz, “CRISP-DM for Data Science: Strengths, Weaknesses and Potential Next Steps,” in IEEE International Conference on Big Data, 2021, pp. 2337–2344. doi: 10.1109/BigData52589.2021.9671634.
C. Schröer, F. Kruse, and J. M. Gómez, “A systematic literature review on applying CRISP-DM process model,” in Procedia Computer Science, Elsevier B.V., 2021, pp. 526–534. doi: 10.1016/j.procs.2021.01.199.
Bila bermanfaat silahkan share artikel ini
Berikan Komentar Anda terhadap artikel Stock Price Prediction Using LSTM and XGBoost with Social Media Sentiment
Pages: 1380-1389
Copyright (c) 2025 Nisa Hanum Harani, Marismati Marismati

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 copyright and grant the journal right of first publication with the work simultaneously licensed under Creative Commons Attribution 4.0 International License that allows others to share the work with an acknowledgment 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 acknowledgment 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) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (Refer to The Effect of Open Access).





















