Can Twitter Sentiment Predict a Company’s Stock Price?

Anyone who’s ever invested in a stock knows that predicting stock prices can be a complex and sometimes risky undertaking.  Stock analysts use a large variety of information to predict and advise whether a stock is on its way up or down.

A recent study at accentedge, an IT company based in Chicago, used Artificial Intelligence (AI) and Machine Learning (ML) technology to see if they could find a correlation between a company’s stock price and the public’s perception of a company as defined by the social media “sentiment” of that company on Twitter.

The researchers began by looking at earlier studies of Twitter sentiments and stock price trends. It is possible to establish “sentiment” about a company, whether people are saying positive or negative things about a company on Twitter and measuring the number of times positive or negative words are being used in Tweets. Those studies indicate a strong correlation exists between the rise and fall in stock prices of a company to the public opinions about that company expressed on Twitter through Tweets.

The study incorporated a Machine Learning Model that included five input features and correlated them to predict the stock price rate-of-change (ROC). The input features included the following input data points on given day:

  • The number of positive Tweets issued today
  • The number of negative Tweets issued today
  • The number of positive Tweets issued yesterday
  • The number of negative Tweets issued yesterday
  • Today’s stock price rate-of-change


A Control Model was also established based on historic stock price data for a company.  The Control Model input features included yesterday’s stock price rate-of-change as well as a target variable, which was today’s stock price rate-of-change. The Control Model is designed to follow the same process minus the Twitter sentiments. If the Control Model performs better than the Machine Learning Model, it means that Twitter sentiments do not correlate with the stock price rate-of-change.

The results of the study, which focused on Tesla automobile company stock, showed that as the Machine Learning model used an increased level of data points, over 1.2 million Tweets used, the Machine Learning Model began to line up with the Control Model. The model was extremely inaccurate on a lower number of Tweets, but once the number of Tweets was increased, the model intercepted the control model accuracy. That means the more Twitter sentiments that are mined, the better the model can be – suggesting that Twitter sentiments can be an important factor in helping predict stock prices.

The study recommends refining the model’s ability to do sentiment analysis by improving the way text is pre-processed, looking at different spellings of words, abbreviations or emoticons and assigning a sentiment to those indicators.

While more work needs to be done to see if Artificial Intelligence and Machine Learning models can predict stock prices, the research showed a strong correlation between Twitter social media Tweets and the actual stock price of a company.  With further development, this technology has the potential to provide an additional tool that stock analysts and investors can use to follow trends and predict stock values.  





To learn more about this study see “AI vs. Momentum: Predicting Stock Prices Using Social Media Sentiment.”