Momentum Trading off Sentiment from r/wallstreetbets

Mjysong
6 min readMay 2, 2020

--

Photo by M. B. M. on Unsplash

2020 has been a wild ride thus far, and the stock market has been no exception. I’ve watched my portfolio whipsaw up and down repeatedly, and I’ve come to the inevitable conclusion that simply nothing makes sense anymore. My apologies to friends who previously relied on me for investing advice! For the last few years, “experts” have been warning about an imminent recession; and yet with a staggering 30+ million Americans unemployed at the time of writing, the S&P 500 index finds itself down only 15% from its all-time high set in February.

“Number 1 Rule on Wall Street… nobody knows if the stock is going to go up, down, sideways, or in f*cking circles.”

— Matthew McConaughey, from “Wolf of Wall Street”.

Courtesy of IMDb

Amusingly, these words have never been more true. So born out of necessity, I was curious to see if I could develop a systematic trading strategy that would strip out the human emotion and decision-making, mostly so I could sleep better at night, and as all self-respecting investors do — blame the model instead of yourself if something goes terribly wrong!

Idea

Background

In recent weeks, a recurring meme on r/wallstreetbets (a Subreddit where retail option traders discuss market speculation, brag about earning millions, and evoke pity for losing their life savings and then some) has been to simply inverse what the majority of the Subreddit is doing in order to make money. This seemed like an interesting thesis, so I decided to create a strategy based on sentiment gathered from r/wallstreetbets. You can find daily recommendations, and a full history of the strategy’s performance here!

Feel free to check it the mornings for live updates, but in no way interpret it as professional investing advice. In other words, please don’t sue me :)

Challenge

To implement this strategy, there must be some method of evaluating whether sentiment is “bullish” (belief that the market will go up) or “bearish” (belief that the market will go down). After not long, I realized that commonly used NLP libraries (i.e. Python’s NLTK) would not be particularly useful here.

The reason is that the language used on r/wallstreetbets is fairly unique. Several common English words have greatly differing meanings in the context of the Subreddit. For instance, on r/wallstreetbets, the words “moon” and “drill” are not objects, but rather verbs describing if a stock’s price will go “up to the moon”, or “drill down”. And instead of being an ordinary office tool, the “printer” is a magical entity used by Fed Chairman Jerome Powell (aka “JPOW”) to inject trillions of dollars and unlimited quantitative easing into the U.S. financial system.

Courtesy of Tenor

Due to the countless hours that were wasted on browsing r/wallstreetbets over the years, I was able to create a dictionary of just under 200 such words, each classified as “Bull” or “Bear”.

Algorithm

Implementation

  1. On the morning of each trading day, before Market Open, the algorithm will request the 25 most-commented threads from the previous day on r/wallstreetbets. I was able to achieve this with the Pushshift API.
  2. Using the custom dictionary mentioned above, the frequency of “bull” and “bear” words are tallied. From these two figures, we define a Bull/Bear ratio.
  3. If the Bull/Bear ratio is above its 10-day exponential moving average (indicating positive sentiment), the algorithm will take a 100% long position by buying SPY shares (an ETF representing the S&P 500 index) at Market Open, and vice-versa. The EMA is preferred over the rolling mean, since the EMA places a greater weight on more recent data, which is needed to capture the most recent market events.

Results

(Full results and trade history)

Backtest Results since Strategy Inception on 04/23/2019

Yay!

Although truthfully, I was not expecting anything remotely impressive, this simple algorithm greatly outperformed the market over the course of the last year — generating a remarkable 61.5% return! By looking at the graph, one can see a bulk of these returns were generated by adopting a short position as the markets crashed in record fashion in early March. However, even before this period, the strategy was still outperforming the S&P 500, indicating that some alpha was generated by its short term portfolio turnover between 100% net long and 100% net short positions.

So is the meme of inversing r/wallstreetbets to generate profit complete nonsense then? Not exactly. Inversing r/wallstreetbets has been frequently suggested in the last month or so. In fact, there is strong merit to this claim:

Backtest Results in April 2020

Yikes.

While the S&P 500 rallied to achieve its best monthly performance since 1987, our strategy managed to lose almost 13% during the same timeframe. What happened to cause this breakdown? I have a few theories:

  1. Perhaps Redditors are more pessimistic than the general population. This negative sentiment is what helped the strategy perform so well in March, as r/wallstreetbets correctly predicted that the markets would capitulate due to Covid-19 fears. However, the subreddit’s sentiment did not adjust quickly enough on the upside to capture the massive rally in April, and the strategy’s short positions incurred serious losses.
  2. It is possible that with everyone stuck at home and with an explosion in market interest from first-time retail investors, that the average investor IQ of the r/wallstreetbets Subreddit has declined. From April 2019 to April 2020, r/wallstreetbets subscriber count has more than doubled from ~530k to ~1.15m.

Pros and Cons

Pros:

  • Simple implementation
  • No prolonged directional exposure (due to frequent turnover)
  • Highly liquid instruments (SPY ETF)

Cons:

  • High turnover (not suitable for investors without zero-commission trading)
  • Potential deteriorating quality of the r/wallstreetbets sentiment metric as the Subreddit grows/the percentage of “smart money” investors shrinks

Potential Improvements

  1. Context matters. Instead of simply counting the number of “bull” or “bear” words as they appear in strings, it would be nice to capture some context too. For instance, although the word “call” (a “call” option is used to bet a stock will go up) is classified as a “bull” word, a phrase like “lel rip call holders” is clearly not bullish sentiment.
  2. Instead of going 100% long or 100% short each time, adjust the portfolio exposure to be proportional to the observed sentiment.
  3. Adjust hyperparameters (i.e. days used in calculating exponential moving average, the bull/bear dictionary, etc.).

Conclusion

So is it worth investing based on this strategy? Although longer-term backtests seem quite promising, the algorithm’s dismal showing in April certainly casts doubts on its legitimacy. So again comes the real question of short-term momentum trading based on sentiment:

Courtesy of Quotefancy

My answer: I don’t know.

--

--