Long Short Term Memory Method and Social Media Sentiment Analysis for Stock Price Prediction

Long Short Term Memory Method and Social Media Sentiment Analysis for Stock Price Prediction


  • I Gede Susrama Mas Diyasa University of Pembangunan Nasional Veteran Jawa Timur
  • Agung Mustika universitas Pembangunan Nasional Veteran Jawa Timur
  • Nurkholis Amanullah universitas Pembangunan Nasional Veteran Jawa Timur


Long Short Term Memory, Social Media, Sentiment Analysis, Stock Price Prediction


The stock market is a complex arena of interest yet uncertainty. Trading stocks, binaries, gold, and bitcoin is growing in popularity, but is prone to price fluctuations influenced by economic and political factors. Social media, particularly Twitter, is where views on companies are shared. Social media sentiment analysis can provide additional insights to evaluate potential future stock price movements, preventing unwanted speculation. The purpose of this research is to develop a Tesla stock price prediction model by integrating the Long Short-Term Memory (LSTM) method and social media sentiment analysis from Twitter to improve prediction accuracy. Stock price data is obtained from Kaggle and Twitter sentiment data is processed through pre-processing. Evaluation values such as Mean Squared Error (MSE) and Root Mean Squared Error (RMSE) are lower in the model with sentiment indicating the ability of the model to more accurately model the dynamics of stock price movements. Lower MSE and RMSE indicate that the model's predictions are closer to the true values, and therefore, the model can be considered more reliable in projecting future stock price changes. These results provide support for the use of Twitter sentiment analysis as a useful source of additional information in improving the prediction accuracy of LSTM regression models in the context of stock market analysis


H. Hamilah, “The Influence of Upstream and Downstream Supply Chain Management on the Indonesia Stock Exchange,” Int. J. Sup. Chain. Mgt, vol. 9, no. 4, pp. 988, 2020.

N. Choirunnisa and N. Fadilah, “Legal Protection for Investors in Crowdfunding Services Through Information Technology Offers (Equity Crowdfunding),” Syiah Kuala Law Journal, vol. 4, no. 2, Aug. 2020.

S. Dewi and T. K. Pertiwi, “Analysis of Stock Investment Decisions on Investors in Surabaya,” Budapest International Research and Critics Institute (BIRCI-Journal): Humanities and Social Sciences, vol. 4, no. 2, pp. 2748-2759, 2021.

S. Biswas, G. Bandyopadhyay, D. Pamucar, and N. Joshi, “A Multi-criteria-based stock selection framework in emerging market,” Operational Research in Engineering Sciences: Theory and Applications, vol. 5, no. 3, pp. 153-193, 2022.

K. Vasista, “Role of a Stock Exchange in Buying and Selling Shares,” International Journal of Current Science (IJCSPUB), vol. 12, no. 1, pp. 2250-1770, 2022.

R. T. Williams, An Introduction to Trading in the Financial Markets: Trading, Markets, Instruments, and Processes. Mill Valley, CA: University Science, 2011.

R. Adewiyah and A. Bawono, “The Effect of Islamic Capital Market Instruments on Indonesia's Economic Growth is Moderated by The Money Supply,” ISLAMICONOMIC: Jurnal Ekonomi Islam, vol. 14, no. 1, 2023.

J. Wuri, “The Role of Investment to the Indonesian Economic Growth,” Journal of Business & Finance in Emerging Markets, Sanata Dharma University, Indonesia, 2018.

L. D. N. Kant, “Global Investment Policy Issues During the Covid-19 Pandemic and Policy Employment On Investment,” in Proc. International Conference Faculty of Law, vol. 1, no. 1, pp. 12-20, 2021.

A. Slobodianyk and G. Abuselidze, “Influence of speculative operations on the investment capital: An empirical analysis of capital markets,” E3S Web of Conferences, vol. 234, p. 00084, 2021.

Z. Syafitri, A. W. Suryani, “Stock Information on Social Media and Stock Return”, The Indonesian Journal of Accounting Research, Vol. 25 (3), pp. 383-412, 2022

P.A. Riyantoko, I. G. Susrama, Sugiarto, Kraugusteeliana, ““F.Q.A.M” Feyn-QLattice Automation Modelling: Python Module of Machine Learning for Data Classification in Water Potability”, International Conference on Informatics, Multimedia, Cyber and Information System (ICIMCIS), IEEE-xplrore, pp. 135-141, 2021

D. A. Prawinata, A. D. Rahajoe, and I. G. S. M. Diyasa, “Analisis Sentimen Kendaraan Listrik Pada Twitter Menggunakan Metode Long Short-Term Memory,” SABER: Jurnal Teknik Informatika, Sains dan Ilmu Komunikasi, vol. 2, no. 1, pp. 300-313, 2024.

S. Jie and Azhar, “Stock Price Prediction Using Long Short-Term Memory,” Applied Information Technology and Computer Science, vol. 4, no. 1, pp. 1311-1324, 2023.

L. Lv, W. Kong, J. Qi, and J. Zhang, “An improved long short-term memory neural network for stock forecast,” MATEC Web of Conferences, vol. 232, p. 01024, 2018.

H. Hewamalage, C. Bergmeir, K. Bandara, “Recurrent Neural Networks for Time Series Forecasting: Current status and future directions”, International Journal of Forecasting, pp. 1-40, 2020

U. P. Iskandar and M. Kurihara, “Long Short-term Memory (LSTM) Networks for Forecasting Reservoir Performances in Carbon Capture, Utilisation, and Storage (CCUS) Operations,” Scientific Contributions Oil and Gas, vol. 45, no. 1, pp. 35-51, 2022.

A. Derakhshan and H. Beigy, “Sentiment analysis on stock social media for stock price movement prediction,” Engineering Applications of Artificial Intelligence, vol. 85, pp. 569-578, 2019.

R. A. Mendoza-Urdiales, J. A. Núñez-Mora, R. J. Santillán-Salgado, and H. Valencia-Herrera, “Twitter sentiment analysis and influence on stock performance using transfer entropy and EGARCH methods,” Entropy, vol. 24, no. 7, p. 874, 2022.

A. Bhadkamar and S. Bhattacharya, “Tesla Inc. Stock Prediction using Sentiment Analysis,” Australasian Accounting, Business and Finance Journal, vol. 16, no. 5, pp. 52-66, 2022.

M. Rodríguez-Ibánez, A. Casánez-Ventura, F. Castejón-Mateos, and P. M. Cuenca-Jiménez, “A review on sentiment analysis from social media platforms,” Expert Systems with Applications, p. 119862, 2023.[1] H. Hamilah, “The Influence of Upstream and Downstream Supply Chain Management on the Indonesia Stock Exchange,” Int. J. Sup. Chain. Mgt, vol. 9, no. 4, pp. 988, 2020.