Understanding Cryptocurrencies with Sentiment Analysis

Sam Couch
3 min readSep 8, 2017

--

“Blockchain this, ICO that!”

If you’ve been on the internet in 2017, surely you’ve seen the chatter about cryptocurrencies. “Crypto! Crypto! Crypto! Blockchain this, ICO that!” Since everyone seems to have an opinion on the viability of cryptocurrencies, I wanted to experiment with tracking the overall sentiment of tweets about Bitcoin (one of the oldest and most widely known form of cryptocurrency) and correlate it to the current price per coin.

Results

Graph showing Bitcoin price overlayed by Twitter sentiment (see caveats below to explain the brief BTC flatline)

Over the weekend that I started monitoring Twitter, China made a bold statement on crytpcurrencies by banning ICO’s. An ICO is essentially a crowdfunding event where companies raise large sums of money via cryptocurrency — think Kickstarter, but on the order of millions of dollars rather than a few thousand. It was interesting to observe the price of Bitcoin fluctuate and the public opinions shift hour-by-hour.

BUY! BUY! BUY!

On 9/3 between 2am and 10am, $BTC dropped nearly $215USD — that’s a dramatic shift in price over 8 hours, but the response is even more interesting to me. In the graph you see a noticeable shift in positive sentiment. Summarizing the tweets myself, a lot of people were less concerned with the price drop and more optimistic that $BTC would quickly recover, thus being a good time to buy.

Not so fast

After the first dip, the price did show some signs of recovery, but continued to plummet until the evening of 9/4. Overall, the market cap of Bitcoin dropped nearly $11 billion USD over 2 days, the sentiment on Twitter reflects this dramatic shift — people were overwhelmingly pessimistic without much relief.

Conclusion

I thought of this more of a thought experiment, since some people seem more skeptical than others about cryptocurrencies in general, what are people saying specifically about bitcoin in response to the current market? In general, it was unsurprising that the sentiment more or less followed the market trend. I’ll continue to track this, one thing I’m curious to see is the “predictive events” that I observed. What I mean is, seeing how optimistic/predictive people were, even when the price dropped by quite a bit, is that something that happens every time there’s a big shift? We’ll see!

Overall I wouldn’t put much stock in the sentiment of Twitter as any indicator of whether you should buy or sell your cryptocurrencies, in general people seem to be incredibly reactive rather than predictive, I guess that’s no surprise.

Some Technical Details

I used Watson Natural Language Understanding to perform the sentiment analysis. I opted to use a serverless architecture that would call a series of functions once per hour (Search twitter > perform sentiment analysis on tweets > get current price of bitcoin > save the data). Below is a small example of how I created two actions, one to get tweets and one to process the tweets with Watson Natural Language Understanding.

Function to get tweets containing “$BTC” and return them for the next action
Function to process tweets with Watson Natural Language Understanding in order to aggregate sentiment

If you’d like to see the complete code that powers this as well as a guide to getting started with Watson and OpenWhisk (serverless platform), check out my repository!

Caveats

* On 9/6 between 12am and 10am, the API I used to get hourly BTC prices seemed to have gone down and served a cached response. I didn’t go through the effort to find the data elsewhere since it began working again.

* I didn’t use the Twitter streaming API, I simply called the search endpoint once per hour. This seemed to work best with their rate limiting scheme. It’s possible that you may get a larger sample size by streaming tweets however.

Make sure to tap that 👏 button and share your thoughts with me on twitter — @samuelcouch!

--

--