Analysts spend years trying to find reliable stock signals, largely unsuccessfully.
What moves the markets? Do news headlines impact stock prices? How about WallStreetBets posts? What about earnings estimates, corporate site visits, The Federal Reserve’s policies, or macroeconomic variables? Innumerable research papers and countless hours are dedicated to finding what makes stock prices tick.
One factor that has reliably moved markets, time and time again, is Elon Musk’s Twitter account. When Elon tweeted “Gamestonk!!”, GME shares “rocketed as much as 157%.” Musk also “sent Dogecoin soaring 60% in minutes with a tweet.” After tweeting, “I kinda like Etsy,” ETSY stock jumped around 10%.
The problem for stock traders is that Elon is tweeting constantly. The vast majority of his tweets aren’t related to any asset, so unless you want to get inundated with innumerable, irrelevant notifications (to a stock trader), you need a way to only get notified with relevant tweets. You also need to know if it’s a positive or negative tweet. Will the tweet cause an asset to increase or decrease in value?
Let’s explore how to use AI to get notified when Elon Musk tweets about any asset, including understanding positive or negative sentiment. We’ll also look at an option to connect this to a trading account. These same principles could be applied to any personality (not just Elon Musk), or even any source of text data (not just Twitter).
Note that this article is not investment advice.
With Zapier, we can build this whole system effortlessly. First, we’ll create a “trigger” that gets activated when Elon Musk tweets. You can select any personality or business account you want, or even duplicate these steps for any number of accounts you’re interested in.
Every time Elon tweets, Zapier will automatically access that tweet, just by specifying his username. We can then set up the flow to run sentiment analysis with Akkio. I added an intermediate step that uses OpenAI’s GPT-3, a natural language model, to extract the specific asset mentioned, but you can go directly to sentiment analysis instead.
Our example tweet mentioned Dogecoin, so my engineered GPT-3 prompt extracted “DOGE.” If no asset was found, it would return the word “none,” so we want to add a filter that stops the sequence if no asset was found.
This filter ensures that we’ll only do sentiment analysis on a tweet that mentions an asset.
I then created a Python snippet, below, to clean the tweet. We want to remove symbols like “@” or “#”, so we can run sentiment analysis on just the text.
When you log in to Akkio, you’ll see that there’s a “text classification demo,” which we can use to classify sentiment. You could also build your own sentiment analysis model on a dataset of just tweets to potentially improve accuracy.
We’ll click to deploy that demo model in Akkio, and then we can send a tweet via Zapier to get classified. Below, in Zapier, we select the “text classification demo” and add in our cleaned tweet text, and we’re done!
Akkio will now predict the sentiment of the tweet. To recap, we’ve now extracted any asset that was mentioned in an Elon Musk tweet, and predicted the sentiment of the associated tweet with Akkio. From here, the sky’s the limit. You could email or SMS yourself a notification, or even use this information to trade real money using Alpaca or Cryptowatch.
For now, let’s make Zapier send us an SMS with the tweet and sentiment prediction whenever Elon tweets about an asset.
Super easy! We now get an SMS with the mentioned asset and sentiment anytime Musk tweets about a financial asset. If you trust your model enough, you could even directly place an order in the stock market with a tool like Alpaca.
While Alpaca doesn’t support cryptocurrencies like Dogecoin, you could use an integration like Cryptowatch to place crypto orders.
If you want to trade both traditional financial assets and cryptocurrencies, you could classify an asset as a “stock” or a “crypto asset,” and then create a “Path” in Zapier to either place an order in Alpaca or Cryptowatch, depending on which asset it is.
If you want to invest like the pros, you need to make sure you’re getting the most accurate, up-to-date information possible. Zapier automation makes this effortless.
You could replicate these steps to follow every Fortune 500 CEO, and get notified about the sentiment of their tweets. You could also replicate these steps on a Google News RSS feed, or on Wall Street Journal headlines, or any other source of text. If you’re not interested in stock trading, the same principles apply to analyzing customer sentiment, or even posts about your competitors.
At Akkio, we’re focused on democratizing AI for everyone. By using Akkio, we’ve shown how you can trade on tweets and other news before it goes viral. Instead of manually monitoring countless sources of text, you can use this guide to analyze text in real-time.