By Joe Ramsahoye

How much influence does Elon Musk have over the cryptocurrency market?

The aims of my project

It is without question that Elon Musk is one of the most powerful figures in the world. He is a controversial character to say the least, which mostly stems from his unfiltered use of social media and wild entrepreneurial ideas dissimilar to that of other influential individuals. In recent years, he has become infatuated with the growing world of cryptocurrencies. In February 2021, his company Tesla announced they had purchased $1.5bn of Bitcoin. Furthermore, he regularly posts cryptocurrency related items on his twitter feed which attract lots of attention in the forms of likes and retweets and he is most notably known for poking fun at one cryptocurrency in particular, Dogecoin. This cryptocurrency was set up as a joke with no fundamental purpose in 2013 to make fun at the speculation around cryptocurrencies at the time. However, in recent years, the coin has gathered serious media attention amassing a market cap of $22bn (as of January 2022) making it the 12th largest coin on the market and many attribute this to Elon Musk. Hence, in this project, I aim to investigate, through the means of chart and regression analysis, how much influence Elon Musk has over the cryptocurrency market as a whole.

The data I used and how it was accessed

Chart 1 used daily spot data from Binance which was available in csv files segregated by month and so the data had to be merged for analysis. The merging process will be described in detail in the next section. Charts 2, 4 and 6 used data from yahoo finance and this was accessed using python through installing the ‘yfinance’ package in google colab. The data for Chart 3 was scraped from using beautiful soup and a loop – click here for the scraper. Chart 5 on Tesla used Alpha Vantages’ API, however due to limitations in the customisability of the API which caused difficulties in making an interactive chart later on. I decided to download the data in python with the ‘AlphaVantage’ package instead- click here to see the code. Charts 7 and 8 used CoinAPI.

Section 1 - Looking at the cryptocurrency market as a whole to identify extreme market periods and potential outliers

Script for merging csv files for chart 1 - click here.
Stata Loop for calculating returns - click here.

Section 2 - Looking at corellations in price between Bitcoin with high market cap coins and small market cap coins to aid in determing factors for price movements

Python notebook for chart 2 - click here.
Scraper notebook for chart 3 - click here.
Python notebook for chart 4 - click here.

Section 3 - Effect of Tesla buying $1.5bn of Bitcoin on the price of Bitcoin and Tesla

Python notebook for chart 5 - click here.
Python notebook for chart 6 - click here.

Section 4 - Effect of Elon Musks Tweets on the price of Dogecoin

Python notebook for twitter scraper - click here.

Challenges in data cleaning and/or analysis, and the tools I used to overcome them

Chart 1 required the most data cleaning and analysis. Each cryptocurrency had its own daily data for each calendar month e.g. BTCUSDT-1d-2019-07.csv. Therefore, the csv files of each month had to be merged to make the full data set for one cryptocurrency. This was achieved by running a script in terminal which can be found here. The closing price column for each data set was then copy and pasted into an excel spreadsheet for analysis. Daily returns for each cryptocurrency were then calculated using a loop in Stata to make the process less tedious - the code can be found here. Moreover, the scraper was the most technically challenging part of this project in terms of the raw coding. This is because the complex nature of the website meant I had to use inspect element to find the ‘td’ element (column) for each variable for scraping to work. I then combined this with a loop to scrape data for the 12 highest market cap coins. The data also had to be cleaned in python because $ were attached to values in the original data which would make it unreadable in Vega. Furthermore, to obtain the Dogecoin related tweets surrounding Chart 8, I scraped tweets from Elon Musk’s twitter account @elonmusk. This was a challenge because twitter has recently implemented mechanisms to stop people scraping without developer APIs. To get around this I used the package ‘pytwitterscraper’ in colab. This is a fairly basic package, but it was enough for me to pull tweets containing “doge” or “Dogecoin” from @elonmusk – to see the scraper click here. Lastly, perhaps the most frustrating thing about the project was CoinAPI’s 100 requests per day limit. This made editing json files in Vega-lite very annoying as I would reach the max requests within a few minutes even when I was being careful and had it running on manual. This resulted in me having to create new email addresses to get more API keys. If I were too repeat the project again, I would use Nomics API instead.

Conclusions of the project

From the visualisations presented, it is clear that Elon Musk has great influence over the cryptocurrency market. For example, despite the $1trn market cap of Bitcoin, after the announcement of Tesla’s $1.5bn purchase a price increase of around 20% is observed, showing his power to induce herding in the market. On the other hand, Tesla’s share price fell in the following months after the announcement resulting in a negative correlation between the Bitcoin and Tesla share price. This could suggest conflicting views and opinions of Tesla and Bitcoin investors. However, the R squared value was 0.07 so this is a weak correlation which could have been attributed to other factors. Furthermore, when looking at dogecoin, we observed no correlation when regressed on Bitcoin with an R squared value of 0.00. This shows that dogecoin tends to move independent of the market which would make sense due its much smaller market cap compared with Bitcoin seen in chart 3 but also its lacking fundamentals perhaps creating a different kind of "speculative investor" perhaps opposed to those in the rest of the market. When analysing chart 8 by using the slider to align the chart with viral dogecoin tweets from @elonmusk, we can see drastic price and volume movements around those periods showing his influence over the price of the coin.