Twitter, one of the world’s largest social media services, has now become a platform for politicians, organisations, and companies to give updates to their followers. Users representing a company or a political party use Twitter to state views on current news, push their political campaigns and even confirm official policy decisions. Important figures that have used the site to broadcast their views to millions of followers include Tesla founder Elon Musk, European Commission President Donald Tusk, and current UK Prime Minister Boris Johnson. For example, Elon Musk caught a lot of negative attention when he tweeted that ‘funding was secured’ to take his electric vehicle company Tesla private. Tesla’s share price rose as much as 8.5% [1] and this resulted in a punitive investigation into Musk by the Securities and Exchange Commission. This led to Musk being ousted as Chairman for the company that he founded, as well as a $20 million fine – all because of one tweet. The President of the United States, Donald Trump, currently has 66.8m followers on Twitter, with the handle “@realDonaldTrump”. Trump is highly active on his Twitter account, averaging approximately 10 tweets a day since 2016 [2]. Trump is candid with his tweets, often making ‘ad hominem’ remarks against his critics, especially against the Democratic Party. Twitter played a huge part in the previous general election (held in 2016), with Trump’s comments eventually instigating an investigation into former rival presidential candidate Hillary Clinton.
In a broad sense, traders and portfolio managers make decisions on whether to buy, sell or hold specific equities (shares of a company) based on the fundamentals of the firm, its management, and its expected value in the future. It is therefore essential to keep up with company news, which may involve earnings calls, new product announcements, and more recently, news delivered by tweets. This ties in with an idea called the ‘efficient market hypothesis. The EMH maintains that shares trade at their intrinsic value on stock exchanges, i.e. all information about a company, its management and its valuation are continuously expressed in the current share price. This implies that when Trump tweets, this information will be reflected in financial markets before it hits headlines.
Data Collection
To analyse Trump’s tweets, we have collected approximately 3000 tweets from 28 July 2019 to 16 November 2019 (retweets included). The Tweets have then been pre-processed to ‘clean’ them, removing hyperlinks and emojis. Next, we have applied a technique called natural language processing, or NLP. At a high level, NLP uses computational techniques to analyse sentences to achieve a specific outcome. Although it may sound complex, you likely use NLP every day. Common examples include predictive text on mobile phone keyboards, language translation on webpages, and search results. The NLP tool we have used is called ‘sentiment analysis’, which essentially determines whether each Tweet is positive, neutral, or negative. The Python module ‘Textblob’ [3] aims to determine the sentiment of a tweet by parsing through each sentence and giving it a score between -1 and 1. For instance, a Tweet including the word “wrong” would usually be given a negative score. Moreover, a Tweet containing the phrase “thank you” would usually be given a positive score. Of course, there are ways in which a Tweet may not always be given the correct sentiment, specifically for economic variables, for example, “high unemployment” may be given a positive sentiment, when low unemployment is actually better for the economy. However, for this task we have used the default Textblob functionality as it has already undergone testing on large datasets through machine learning.
Using the data we have collected, we can explain its distribution visually. Figure 1 shows the distribution of sentiment for each of Donald Trump’s tweets. Of the approximately 3000 tweets analysed, 662 tweets were given a negative sentiment, 798 neutral and 1415 positive.
Figure 1
Source: Twitter, Python. Tweets collected using Twitter API & Tweepy.
Figure 2 shows that the frequency of Trump’s tweets has dramatically increased from the averages of 2016 (includes retweets).
To measure the effect these tweets have on stock market returns, we have decided to use the S&P 500 Index, a weighted average of the 500 largest companies trading on the US stock exchange.
In order to use the most representative data possible, we have filtered tweets that are related to the stock market according to specific words, such as ‘trade’, ‘China’, ‘Powell’ and more, as they are more likely to have the potential to move markets. This trimmed down our total tweet count to around 500. The tweets were then given a score depending on their sentiment, and later transformed into a series, rebased at the value of the S&P 500 at our start date. When giving the scores, we considered that investors are loss averse – meaning that the sadness that they get from a loss is greater than the happiness they gain of the same magnitude. The two series can be seen in Figure 3.
Figure 3
Visually, we can see that the trend of the stock market and Trump’s tweets seem to move together. When running a correlation between the two series, the positive correlation of 0.63 implies that Trump’s tweets do in fact move with the stock market. However, importantly, correlation does not imply causation. In other words, we have no indication of the direction of the relationship. There are also many individual factors that may affect stock returns such as interest rates, inflation expectations and other random factors. The interpretation of the relationship we have found is more likely that the tweets coincide with market-moving events such as a surprising economic data release or a monetary policy decision, after markets have reacted to the data. Therefore, we cannot say that with 100% confidence that Trump’s tweets pre-emptively affect the stock market. However, it is more than likely that the sentiment of the tweets correlates positively with market returns.
I’m a second-year Economics student at the University of Bath who is highly motivated with an excellent work ethic. I am an inquisitive thinker with an analytical mind and a solution-oriented approach and have a keen interest in markets and investment management.