PyQuant News

A Trading Strategy Based on Elon Musk’s Tweets

A Trading Strategy Based on Elon Musk’s Tweets

Time magazine’s Man of the Year 2021, Elon Musk. Could a trading strategy based on Elon Musk’s tweets also be the driver of your most profitable investment strategy?

It’s no secret that Elon carries the power to influence markets with 280 characters of text. We wanted to know if his musings on Twitter could be exploited as a trading strategy. Here’s what we found.

Do Elon’s Tweets Really Affect the Market?

We’ll begin with a retrospective view of Elon’s Twitter activity, confirming our suspicions that his tweets can move prices. We used string matching to extract tweets and replies related to Bitcoin (34 tweets/replies identified) and Dogecoin (44 tweets/replies identified) in the first 6 months of 2021. Let’s take a look at how the price of these assets evolved around the time of Elon’s tweets:

A Trading Strategy Based on Elon Musk’s Tweets

Each line shows 1-min price action from 5 minutes before to 60 minutes after a tweet. The prices have been normalised to the price just before the tweet was published. There’s a clear response to DOGE tweets, with an 11% increase within a minute of publication in one case! For Bitcoin, we see a few big swings up and down – these are where Tesla introduced and removed BTC as a payment currency.

A Trading Strategy Based on Elon Musk’s Tweets

We’ll simulate a trading strategy based on Elon Musk’s tweets by entering the market with a long trade as soon as Elon tweets. We buy if the tweet contains the substrings {‘crypto’, ‘bitcoin’, ‘btc’} for bitcoin and {‘doge’} for doge (not just the whole word) – so, if it says ‘replyto@dogeuser’ we’ll also place a buy order.

We’ll then follow the price with a trailing stop order, exiting once it decreases by a certain % from its peak since we entered (0.66% for BTC; 1% for DOGE, which is more volatile). Something like this:

A Trading Strategy Based on Elon Musk's Tweets

Running a simulation with this strategy, going long on every crypto-related tweet, we get the following returns for the two assets:

A Trading Strategy Based on Elon Musk's Tweets

An 11% return (1.98 Sharpe) on Bitcoin and a staggering 267% (6.45 Sharpe) on Dogecoin – not bad for 6 months work! The drawdowns are largely the result of 

  1. Negative tweets. We could use Natural language processing to identify these and go short.
  2. Working with 1-minute price resolution. We had to ride out big drops until the next minute.

This is a small insight into how alternative (non-financial) data influences the crypto market and the rewards that await those who can capitalise. 

Data Availability

Want to see the data and follow the code? Check out this Kaggle Notebook:  https://www.kaggle.com/code/uintresearch/unsigned-sandbox-musk-tweets

This is a guest post by @iSeekLong.

Unsigned Research is a global quantitative investment research group. They’re a collective of experts in computer science, mathematics, finance, and distributed networks.

Join your Fellow Pythonistas on PyQuant News

Follow Us

Recent Posts

Related Posts