MATEC Web of Conferences (Jan 2023)

A hybrid sentiment based stock price prediction model using machine learning

  • Mehmood Awais,
  • Khurram Ali Muhammad

DOI
https://doi.org/10.1051/matecconf/202338101017
Journal volume & issue
Vol. 381
p. 01017

Abstract

Read online

Accurate stock market prediction is highly desirable to corporations and investors. In this study a deep learning model based on LSTM, BiLSTM with attention mechanism used to predict stocks closing price for next 30 days of two banks listed in Pakistan Stock Exchange. For accurate stock price prediction, it is necessary to consider volatile factors such as news sentiments along with historical data. This study covers that aspect by incorporating news sentiments along with historical stock data that is distributed over a span of ten years from Jan 2011 to July 2021. Preprocessing and sentiment analysis of data was performed using python NLTK module. After that we built a univariate deep learning model based on four layers of LSTM and one dense layer to combine all layers and performed a prediction on train and test data followed by a multivariate deep learning model based on BiLSTM with self-attention mechanism and found out that incorporation of news sentiments really improved the prediction accuracy by reducing the values of mean squared error. Finally, we did the prediction for next 30 days of stock closing price of two banks and compared those predicted prices with actual prices and got quite accurate results.

Keywords