The Papa Musk Twitter Bot
An Algorithm that will buy everything Elon Musk is Tweeting about
About the algorithm
Never miss another DogeCoin rally again!
Without a doubt last month has been the craziest month in the markets since the Covid crash in March last year. The short squeeze mania has driven many people to the markets in the search for easy money. Now I don’t know if it’s this influx of money or just pure love people seem to have for Papa Musk that caused a new edge to appear in the market. Elon’s Twitter feed!
Whatever the Father of Tesla tweets about starts moving drastically. One perfect example was his tweet about DogeCoin ($XDG) that caused the coin to move as much as 388% in the following 24 hours… An example before that was his tweet about Etsy that helped the stock creep out of a drawdown by spiking the price up 6%.
How Papa Musk’s Twitter Bot was born
As soon as I noticed this weird edge, being a quantitative trader, the only thing I could do was to test it by placing money on it. And if I want to place money on his tweets — I cannot be late to the party when it happens.
So naturally, the following thought was to create an algorithm that would monitor Elon’s Twitter feed and perform the trades automatically or at the very least notify me when something interesting starts happening.
Today I want to share this algorithm with you. No charge, no credit cards, no catch. Just take it and use it.
Diamond Zemaitis, Chief Executive Officer
How to run the algorithm?
How does it work?
As Steve Jobs once said — “People do not need to know how the products they use work, in order to use them”. You do not need to understand the nuances of the algorithm in order to use it, yet it is always helpful, especially when your hard-earned cash is at stake.
The algorithm is executed within the Diamond Strategies trading automation environment. This means that the algorithm will run once every specified period of time. I have found every 1 minute to be way more than enough. Even 10 minutes should do the job without you being late for the party.
The gist is the algorithm reads new tweets Elon Musk posts and tries to find keywords within those tweets and relate them back to specific investment instruments. In order to do this, we will use a .csv keywords file. Within the file there should be 2 columns:
- The investment instrument symbol;
- a semicolon (;) separated list of keywords related to this instrument.
I provide the default files for cryptocurrencies and stocks with the algorithm as you download it. The default ones should be more than enough to trigger proper trades without missing anything, however, if you want to expand the keyword lists you can certainly do so within the CSV file.
Try it for yourself
As simple as it sounds. The algorithm first gets the tweets from Elon’s timeline.
Iterates through the list of new tweets (if more than one was posted since the last execution cycle) and looks for keywords within the tweets and locates the related trading instruments. And stores the instruments found to the trades-to-execute list.
Gets the description of Elon’s Twitter account and checks if the description was changed. If it was the same logic as within the tween loop is executed on the new description — attempt to locate any keywords and related instruments and if found store them to the trades-to-execute list.
Iterates through the trades-to-execute list and using an NLP AI algorithm checks the sentiment of the text that is referencing this instrument (i.e. a tweet or new description where the keyword was found). This is done in order to eliminate any tweets where he may be commenting something negative about a company or cryptocurrency. We only want to take LONG trades since that seems to have the main edge, hence we try to eliminate anything that he may not be referring to as a good long candidate. If the sentiment of the tweet is negative this potential trade is removed from the trades-to-execute list.
Executes the purchase orders for the trades that are remaining in the trades-to-execute list.
Sends an email notification to you about the trades executed and what tweet/keyword combo triggered these trades.
That’s pretty much it. The algorithm also can run in Notification Only mode too. This means that it would skip step #5 and if a potential trade opportunity is found you would simply get an email about it and would have to execute the trade manually.
At the time of writing, the algorithm can only execute automatic trades for cryptocurrencies on Kraken. For other exchanges and Stock trades, the algorithm can only run in Notification Only mode.