Twitter Mood Predicts the Stock Market

This paper seeks to determine whether public sentiment, as measured in Twitter posts, can be used as a predictor of stock market performance. Two sources of public mood are used—OpinionFinder (OF) which measures mood on a binary positive/negative scale, and the Google Profile of Mood States (GPOMS) which measures sentiment in terms of 6 mood dimensions – calm, alert, sure, vital, kind, and happy. Approximately 9.8 million tweets containing explicit expressions of the user’s mood, such as “I feel,” are analyzed, and the list is filtered for spam tweets. Then, three analysis phases are applied to the data: firstly, the creation and classification of public mood based on OF and GPOMS time series. Next, a Granger causality analysis is used to correlate Dow Jones Industrial Average (DJIA) daily close values with the GPOMS and OF mood data. In the third phase, an application of machine learning known as a Self-Organizing Fuzzy Neural Network is used to predict DJIA values based on past DJIA values and public mood data from OF and GPOMS.

The tests are conducted to capture public sentiment via Twitter over a 3-month period of time which includes two socio-cultural events that may have an effect on public mood (a presidential election and the Thanksgiving holiday in the US). OF is shown to successfully identify public sentiment regarding the election and the holiday by indicating a sharp but short-lived spike in positive sentiment to those days. However, the GPOMS results reveal a more robust measure of public sentiment by characterizing tweets into 6 different mood categories. Next, the correlation between the results obtained from OF and the results obtained by using GPOMS is evaluated using multiple regression, and it is concluded that certain GPOMS mood dimensions overlap with the mood values provided by OF.

A Granger causality analysis is used to correlate OF and GPOMS public mood with DJIA values. The results of this test indicate Calm has the highest Granger causality relation with DJIA, while the other mood dimensions provided by GPOMS and OF have no significant causal relationship with changes in the DJIA. However, since the correlation between sentiment and stock market values is not likely to be linear, the performance of a Self-Organizing Fuzzy Neural Network is compared to the various permutations of mood time series.

The purpose of this study was to test the hypothesis that the prediction accuracy of DJIA prediction models can be improved by including measurements of public mood. The results indicate adding positive/negative sentiment from OF has no effect on prediction accuracy compared to using only historical DJIA values. However, adding the mood value ‘Calm’ results provides the highest prediction accuracy. These results strongly indicate a correlation between sentiment data and DJIA values, however this study does not determine causative mechanisms that may connect the two.


Interested in learning more about the applications of machine learning? Click here.

Risk Warning: The FXCM Group does not guarantee accuracy and will not accept liability for any loss or damage which arise directly or indirectly from use of or reliance on information contained within the webinars. The FXCM Group may provide general commentary which is not intended as investment advice and must not be construed as such. FX/CFD trading carries a risk of losses in excess of your deposited funds and may not be suitable for all investors. Please ensure that you fully understand the risks involved.