Important figures that have used Twitter 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. The consequences for this were the ousting of Musk as Chairman for the company that he founded, as well as a $20 million fine – all because of one tweet.
Former President of the United States, Donald Trump, currently has 66.8m followers on Twitter, with the handle “@realDonaldTrump”. Trump is very 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 towards 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 upon the firm's fundamentals , its management, and its expected value in the future. Therefore, it is essential to stay up to date with company news, which may involve earnings calls, new product announcements, and more recently, tweets including breaking news. 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 suggests 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 natural language processing technique, or NLP. At a high level, NLP uses computational techniques to analyse sentences to achieve a specific goal. Although it may sound complex, NLP is used by most 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 example, 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. For further insight into how NLP can be used to aid trader investment, visit StockGeist’s stock sentiment features.
Using the obtained data, we can explain its distribution visually. Figure 1 outlines the distribution of sentiment for each of Donald Trump’s tweets. Of the ~3000 tweets analysed, 662 tweets were given a negative sentiment, 798 neutral and 1415 positive.
For usage of 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 reduced 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 providing 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.
Visually, the graph suggests 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 various individual factors that may affect stock returns such as interest rates, inflation expectations and other unconsidered 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 preemptively affect the stock market. However, it is highly likely that the sentiment of the tweets correlates positively with market returns.
Keep up to date with the real time market psychology and how this changes as events unfold via StockGeist.ai. Alternatively, enhance your own project by integrating stock news sentiment API.