Using Twitter Sentiment for Market Decisions

This is a repost from

In October 2014, I successfully defended my dissertation titled “Analysis of Twitter Messages for Sentiment and Insight for use in Stock Market Decision Making.” This dissertation was the final step in earning more D.Sc. in Information Systems.

In my dissertation, I reported on my research into using natural language processing (NLP) to perform sentiment analysis on Twitter messages. This sentiment is then analyzed to determine if this sentiment can be used for stock market investing decisions using the idea of the Bear/Bull ratio which is a quantitative measure of sentiment from Twitter. The research conducted for my dissertation is the baseline for the services on this website.

You can view a video of my dissertation defense below (or click over to Vimeo to watch it there).  Additionally, I’ve created a PDF version of my dissertation and I’ve listed it for sale on my Trade The Sentiment website  for $50 per copy. You can purchase this dissertation and read up on some of the research that is the basis of this site by buying a copy for yourself. on this site. When you purchase a copy, you’ll have access to download a PDF version of my dissertation. To purchase a copy for yourself, you can click here and use Paypal or Stripe to buy a copy.

Note: If you are an academic research or doctoral student, please contact me directly and I’ll share a copy of my dissertation for free.

Using Twitter Sentiment in the Stock Market from Eric D Brown on Vimeo.

Introducing the New Trade The Sentiment – From Theory to Product

Originally posted on

Today, I launched the new version of Trade The Sentiment.

Rather than just following along on my blog with static charts, you can now access all the signal information you want / need with the new interactive service on the website.

On the new site, I have a few free charts available for users to review. These charts will always be freely accessible without the need to signup or login to the site.  My hope is that you’ll find these freely available charts valuable and want to join the site to access the many thousands of symbols being tracked and reported on. To access these additional symbols and charts, you’ll need to signup for an account. You’ll receive access to the paid side of the website for 30 days for free…after those 30 days, you’ll need to sign up for a ‘paid’ account, which is currently $75 per month for a short introductory time.

Check out the site. Sign up for an account and dig into the services I’m offering….and please do let me know any feedback you may have.

I’ll be sharing more about the new features of the coming days here on the blog. While you are waiting, feel free to read bout the features and check out the site for yourself.

For now, here’s a sneak peak of the new charts and what the service has to offer.

Lastly – if you do check out the new site and have any issue or have any questions, please contact me and I’ll be happy to help you out.




My Doctoral Dissertation Final Defense – Almost done

I am now one step closer to finishing my doctorate. On Friday Oct 31, I defended my dissertation. The video of the presentation during the defense is provided below. I now only have to get a few documents signed and format my dissertation for publishing and I’ll be completely finished.

The title of my dissertation is: “Analysis of Twitter Messages for Sentiment and Insight for use in Stock Market Decision Making.”

The video is a bit over 1 hour and 12 minutes long. I cut out the question and answer session for the sake of brevity.

Using Twitter Sentiment in the Stock Market from Eric D Brown on Vimeo.

This video is a copy of my Doctoral Dissertation defense. The topic: Analysis of Twitter Messages for Sentiment and Insight for use in Stock Market Decision Making.

Dissertation Title: “Analysis of Twitter Messages for Sentiment and Insight for use in Stock Market Decision Making”


Comparing Sentiment Extreme Entries with Random Entries – Multiple Symbols

This is a cross-post from Trade The Sentiment

In my post titled Correlations – Twitter Sentiment, AAII Sentiment Survey and the S&P 500 Index I mentioned the following:

Using my training data set and the Python Natural Language Toolkit’s Naive Bayesian Classification methods and performing statistical correlations using the Pearson Correlation method, there is virtually no correlation between the overall market Daily Twitter sentiment and the Daily closing price of the SPX.

While there isn’t any correlation between daily/weekly SPX closing prices and the overall Twitter market sentiment (using my analysis methods), there are some interesting signals coming out of this research into twitter sentiment.

The most interesting signal so far has been that of an “extreme” in sentiment.    I’ve been running quite a lot of analysis using Twitter Sentiment Extremes as signals for entries and have been quite impressed with using Twitter Sentiment Extremes as entry signals.

I’ve shared a number of these analyses over the last few months. A few examples can be found in the following posts:

For the purposes of understanding how accurate these signals are, I setup the following test to compare Twitter Sentiment Extreme Signals vs Random Entries.  I’ve run a portion of this test before in the Comparing Twitter Sentiment vs Random Numbers for Entry Signals post but I wanted take it a step further and test multiple symbols and compare Twitter Signals with Random Entries.

The strategy

Rather than just use one or two symbols, I wanted to take a look at how these Extreme signals would work across multiple symbols and markets.  In addition, I have used the full market sentiment signal rather than the individual symbol sentiment signal in order to test the market sentiment signal in general.

I used the following symbols:

Using Tradestation as my test platform, I ran through each symbol using Twitter Sentiment Data.  The strategy details are:

  • Date Range: Nov 1 2011 to Dec 31 2012.
  • Strategy is Long only
  • Use overall Market Sentiment
  • Extreme is defined as a Bear / Bull Ratio of 1.1 or higher
  • For futures, use 5 contracts. For Stocks/ETF’s, buy 500 shares
  • Buy at open following day after an extreme is found
  • Hold position for 6 days
  • Commission and Slippage are included
  • Returns are calculated on $300,000 account

Results of Twitter Sentiment Signals

As you can see, the returns found while trading futures are quite impressive with returns a factor of 10 higher than trading the ETF’s or the majority of the S&P 10 symbols (other than AAPL).

Testing Random Signals

Next, I wanted to take a look at this same strategy and symbols using random entry signals.  In order to get a good sampling of data, I created ten random signals using a random number generator and input these signals into Tradestation and ran the same strategy as above.

The results of the ten random entry signals averaged together:

Comparing Results

A quick glance of the Futures results shows a dramatic difference between the Twitter Signals and Random Entries.

As you can see, in general, the Twitter sentiment signal provides a pretty good indicator.  The average return from Twitter sentiment is higher than the average return on random signal entries.   In addition, the media return is higher for twitter sentiment for futures and ETF’s but not for the S&P 10 symbols.

When compared with the return of the S&P500 Index from Nov 1 2011 to Dec 31 2012 of 8.58% (found using Tradestation’s “Buy and Hold Return” performance statistic), the Twitter Sentiment signals provide an excellent market entry signal with excellent returns when used in the Futures markets.  The returns found with ETF’s are surprising, but if we increase the number of shares purchases, returns increase a good deal (e.g., with SPY @ 500 shares, return 2.91% and with 1000 shares, return = 5.41%).

To improve performance, a lot of work can be done on risk management and exit criteria, which would most likely improve performance, but the purpose of this particular test was to compare random signals vs twitter sentiment…and I think the results speak for themselves: There seems to be a definite edge to be found in using Twitter Sentiment Extreme signals for entry signals.

This is a cross-post from Trade The Sentiment

Correlations – Twitter Sentiment, AAII Sentiment Survey and the S&P 500 Index

This is a cross-post from Trade The Sentiment

I just finished presenting a paper titled Bulls, Bears…and Birds? Studying the Correlation between Twitter Sentiment and the S&P 500 Index at the Business Intelligence Congress 3 in Orlando Florida.  Once the paper is formally published, I’ll share a link to the PDF.  Oh….and the paper won best Research paper at the conference 🙂

A quote from the abstract of the paper:

This research had three main goals: 1.) To determine if data analytics can be used to automate sentiment analysis from Twitter messages; 2.) To determine whether the outcome of the analytical engine is comparable to existing survey methods and finally; 3.) To determine if there is any actionable knowledge contained within Twitter sentiment that can be used to make investing decisions.

Each of the above goals was accomplished. Twitter data can be collected and analyzed using standard sentiment analysis methods. Additionally, using Bayesian Classification techniques combined with a manually generated training data set, resulted in an outcome which is correlated to existing sentiment survey methods (e.g., the AAII Sentiment Survey). Lastly, using standard statistical methods, there is very little statistical correlation between the Twitter Sentiment found within this study’s sentiment analysis methods and the closing price of S&P 500 Index.

Using my training data set and the Python Natural Language Toolkit’s Naive Bayesian Classification methods and performing statistical correlations using the Pearson Correlation method, there is virtually no correlation between the overall market Daily Twitter sentiment and the Daily closing price of the SPX.

Using Pearson Correlation methods is a standard method of determining whether a linear relationship exists between between two sets of data. The correlation values range from +1 to -1 with a value of +1 meaning that there is a perfect linear correlation between the two data sets and a value of -1 meaning that there is a perfect inverse linear relationship between the two data sets. A value of 0 means there is no correlation between the two data sets.  Note: looking for a linear relationship between sentiment and SPX Close price might be naive here, but its the simplest relationship to begin with.

A Scatterplot of Daily Twitter Sentiment Data and Daily SPX Close prices shows virtually no linear relationship exists.


Correlation Details of the Daily Bear/Bull Ration and SPX Close:

Bulls, Bears and Birds - Final-name.docx - Microsoft Word non-commercial use_2012-12-15_11-09-57

Additionally, there is virtually no correlation between the AAII Sentiment Survey and the SPX Weekly Closing Price nor is there any correlation between the Weekly Twitter Sentiment and the SPX Weekly Closing price.

Bulls, Bears and Birds - Final-name.docx - Microsoft Word non-commercial use_2012-12-15_11-12-51

There is, however, a fairly strong correlation between Twitter Sentiment on a Weekly Basis and the Weekly Sentiment Survey released by the American Association of Individual Investors (AAII) with a Pearson Correlation value of 0.583 being found.

Correlation Details of the AAII Weekly Sentiment Survey and Weekly Twitter Bear/Bull Ratio:

Bulls, Bears and Birds - Final-name.docx - Microsoft Word non-commercial use_2012-12-15_11-13-11

The conclusion?

Using my training dataset and my implementation of the Naive Bayesian classifier, there is no significant correlation between Twitter Sentiment and SPX Close Price on a Daily or Weekly Basis.  That said, there is a High Correlation between Weekly Twitter Sentiment and the AAII Sentiment Weekly Survey.

Does this lack of correlation mean that Twitter Sentiment (or AAII Sentiment) is useless?

I don’t think so.  In fact, I believe it is very important data.

I’ve written about the use of Sentiment Extremes as a buy/sell signal in the past and I see some real value in these signals. There a number of academic and industry articles describing the use of sentiment and sentiment extremes as contrarian signals. In fact, the AAII has even published an article that discusses the use of sentiment as a contrarian signal.

I’ve been focusing most of my efforts on identifying sentiment extremes and using those values as inputs into investing strategies.  These entry signals appear to be providing exceptional returns with little drawdown when using proper risk management methods.

Additionally, these entry signals from extremes seem to be a better entry method than just taking a random entry as described in my post that compares a Bearish Extreme signal compared to entries taken with a random signal. In that article, it appears that additional returns found using Bearish Extremes from Twitter as an entry signal when compared to entering on a random entry signal.

In fact, using the overall sentiment from Twitter and using extreme levels as an entry signal has delivered pretty good returns over the past year…better than I even initially expect.

How good are the results?  Check back in a few days for a report. 🙂

This is a cross-post from Trade The Sentiment

Finding SPX Support / Resistance Levels from Twitter

This is a cross-post from Trade The Sentiment

In addition to finding sentiment within Twitter messages, there are other data points that can be found in many messages.

One of the key data points is price levels.  A good number of people add their thoughts on stops, pivots, support/resistance levels, etc for various instruments on twitter.    After reading‘s post on support/resistance levels from Twitter, I took a look at my dataset to see if I could find anything interesting.

I’ve gone through each twitter message I’ve captured (over 2 million of them) and captured each mention of a ‘level’ (support, resistance, etc). I took each of those mentions and stored them off in another database for each symbol segregated by dates (I currently average the data…but am looking at other approaches). With these new data-sets, I can then look at these levels that are shared….and I see some interesting data.

As a test, I grabbed the S&P 500 Index (SPX) levels and plotted them along with the closing price of the SPX….I’ll let you make your own decision on how interesting you think it is…but I’m seeing some statistical significance in the data-sets….the next step is just determining how best to use this data.

For this post, I took the SPX Data from Nov 1 2011 to Nov 28 2012.

Some basic stats for comparison:

  • Twitter Levels Median for 21 days: 1381.91 and the mean is 1378.57
  • SPX Median for 21 days: 1394.53 and the mean is 1394.75

The first plot is the SPX Close price in Green with the Twitter Level 21 Day Moving Average in Red. As you can see, Twitter Levels do a pretty good job of tracking the SPX.

To smooth out the SPX, I also took a look at plotting the 21 Day Moving Average of the SPX Close shown in Green.   I’ve taken the 21 Day Moving Average of the Twitter Levels and plotted them in Red.

This is a cross-post from Trade The Sentiment

If you'd like to receive updates when new posts are published, signup for my mailing list. I won't sell or share your email.