B3 Stock Price Prediction Using LSTM Neural Networks and Sentiment Analysis
Keywords:financial market, stock exchange, recurring neural networks, LSTM, Sentiment Analysis
This article presents an approach to predict stock prices which incorporate sentiment analysis from Twitter posts as an input to an Long Short Term Memory (LSTM) Neural Network to help in the decision process. The sentiment analysis measures subjectivity and polarity as well as the number of tweets about the company to capture the market mood, which influences the stock prices, were evaluated. The main company used to evaluate our method is Vale (VALE3). The sentiment analysis helps to reach an Root Mean Squared Error (RMSE) of 0.021. We also validate our method with JHSF (JHSF3) and Usiminas (USIM3), obtaining RMSE of 0.012 and 0.016, respectively.
H. Lastres and S. Albagli, Informação e globalização na era do conhecimento. Editora Elsevier, 1999. [Online]. Available:
E. Schöneburg, “Stock price prediction using neural networks: A project report,” Neurocomputing, vol. 2, no. 1, pp. 17–27, 1990.
M. L.Lima, T. P. Nascimento, S. Labidi, N. S. Timbo, M. V. L. Batista,G. N. Neto, E. A. M. Costa, and S. R. S. Sousa, “Using Sentiment Analysis for Stock Exchange Prediction,” International Journal of Artificial Intelligence & Applications, vol. 7, no. 1, pp. 59–67, Jan. 2016. [Online]. Available: http://www.aircconline.com/ijaia/V7N1/7116ijaia06.pdf
S. Boro vkova and I. Tsiamas, “An ensemble of lstm neural networks for high-frequency stock market classification,” Journal of Forecasting,vol. 38, no. 6, pp. 600–619, 2019.
Y. Liu, Z. Qin, P. Li, and T. Wan, “Stock volatility prediction using recurrent neural networks with sentiment analysis,” in International Conference on Industrial, Engineering and Other Applications of Applied Intelligent Systems. Springer, 2017, pp. 192–201.
J. Bollen, H. Mao, and X. Zeng, “Twitter mood predicts the stock market,” Journal of Computational Science, vol. 2, no. 1, pp. 1–8, Mar. 2011. [Online]. Available: https://linkinghub.elsevier.com/retrieve/pii/S187775031100007X
S. Mohammad, S. Kiritchenko, and X. Zhu, “NRC-Canada: Building the state-of-the-art in sentiment analysis of tweets,” in Second Joint Conference on Lexical and Computational Semantics (*SEM), Volume 2: Proceedings of SemEval 2013. Association for Computational Linguistics, 2013, pp. 321–327. [Online]. Available: https://aclanthology.org/S13-2053
M. Araújo, P. Gonçalves, M. Cha, and F. Benevenuto, “ifeel: a system that compares and combines sentiment analysis methods,” in Proceedings of the 23rd International Conference on World Wide Web. ACM, 2014, pp. 75–78.
H. R. O. Rocha and M. Macedo, “Previsão do preço de ações usando redes neurais,” in Congresso USP de Iniciação Cientı́fica em Contabilidade, 2011.
C.-R. Ko and H.-T. Chang, “Lstm-based sentiment analysis for stock price forecast,” PeerJ Computer Science, vol. 7, p. e408, 2021.
W. Khan, M. A. Ghazanfar, M. A. Azam, A. Karami, K. H. Alyoubi, and A. S. Alfakeeh, “Stock market prediction using machine learning classifiers and social media, news,” Journal of Ambient Intelligence and Humanized Computing, pp. 1–24, 2020.
Y. Jiang, Y. Zuo, and Y. Yang, “Machine learning and artificial intelligence applied in the research of the emotions impact on forecasting,” Journal of Physics: Conference Series, vol. 1982, no. 1, p. 012052, jul 2021. [Online]. Available: https://doi.org/10.1088/1742-6596/1982/1/012052
B. A. Januário, A. E. d. O. Carosia, A. E. A. da Silva, and G. P. Coelho, “Sentiment analysis applied to news from the brazilian stock market,” IEEE Latin America Transactions, vol. 20, no. 3, pp. 512–518, 2021.
F. Audrino, F. Sigrist, and D. Ballinari, “The impact of sentiment and attention measures on stock market volatility,” International Journal of Forecasting, vol. 36, no. 2, pp. 334–357, 2020.
I. Botunac, A. Panjkota, and M. Matetic, “The importance of time series data filtering for predicting the direction of stock market movement using neural networks,” in Proceedings of the 30th DAAAM International Symposium, 2019.
A. GUMUS and C. O. SAKAR, “Stock market prediction by combining stock price information and sentiment analysis,” International Journal of Advances in Engineering and Pure Sciences, vol. 33, no. 1, pp. 18–27, 2021.
D. P. Gandhmal and K. Kumar, “Systematic analysis and review of stock market prediction techniques,” Computer Science Review, vol. 34, p. 100190, 2019.
A. Graves, M. Liwicki, S. Fernández, R. Bertolami, H. Bunke, and J. Schmidhuber, “A novel connectionist system for unconstrained handwriting recognition,” IEEE transactions on pattern analysis and machine intelligence, vol. 31, no. 5, pp. 855–868, 2008.
T. Swathi, N. Kasiviswanath, and A. A. Rao, “An optimal deep learning-based lstm for stock price prediction using twitter sentiment analysis,” Applied Intelligence, Mar 2022. [Online]. Available: https://doi.org/10.1007/s10489-022-03175-2
O. Brito, Mercado financeiro. Saraiva Educação SA, 2019.
A. Graves, Supervised Sequence Labelling with Recurrent Neural Networks, ser. Studies in computational intelligence. Berlin: Springer, 2012. [Online]. Available: https://cds.cern.ch/record/1503877
S. Hochreiter and J. Schmidhuber, “Long short-term memory,” Neural computation, vol. 9, no. 8, pp. 1735–1780, 1997.
C. Olah, “Understanding lstm networks,” 2015. [Online]. Available:http://colah.github.io/posts/2015-08-Understanding-LSTMs/
B. Pang and L. Lee, “Opinion mining and sentiment analysis,” Foundations and Trends in Information Retrieval, vol. 2, no. 1-2, pp. 1–135, 2008. [Online]. Available: http://www.cs.cornell.edu/home/llee/opinion-mining-sentiment-analysis-survey.html
S. Asur and B. A. Huberman, “Predicting the future with social media,” in Proceedings of the 2010 IEEE/WIC/ACM International Conference on Web Intelligence and Intelligent Agent Technology-Volume 01, I. C. Society, Ed., 2010.
H. Theil, “The development of international inequality 1960–1985,” Journal of Econometrics, vol. 42, no. 1, pp. 145–155, 1989.