I submitted this work as the final written assignment during my Blockchain course at the University of Zürich, hope you find it interesting! This first part is setting the ground of my work concerning Bitcoin. It is quite academic for the first 2 parts. If you want to have insights into the code and the development framework please jump directly to The last part.

If you want to have a look at the website that we built : http://www.sentcrypt.com/

1 Introduction

1 a. Abstract

Purpose – The purpose of this document is first to explore and present the state of the art concerning the valuation of Bitcoin and sentiment analysis in the context of Bitcoin price and then implement our own solution and framework to capture and compare the price of Bitcoin to the general sentiment of tweets.

Design – The collection of the data will be made with Python through APIs, the storing will be done in a PostgreSQL database, the infrastructure and the hosting will be done on Heroku. The data will be streamed live into charts and tables and then displayed on www.sentcrypt.com.

Findings – In general, we can identify a link and an interaction between twitter sentiment and the price of bitcoin.

Value – The work is done for educational purposes, as such it has limited financial or research value.

Keywords – Bitcoin, Bitcoin Price, Sentiment Analysis, Twitter, APIs, Python.

Paper type – Project report

1 b. Context

Being born in 2009 Blockchain and Bitcoin are rather young technologies, slowly maturing and attracting growing interest from the public, the media and the financial industry. The peak of the media coverage was observed in 2017 when the market grew from 14.589 B to 535.58 B in the span of 11 month (source: link ). Suddenly Bitcoin was on the front page of every magazine of the planet and everybody was caught in the BTC frenzy.

Not everyone was bullish about Bitcoin. The banking old guard was especially dubitative concerning this decentralized currency that could represent a threat to the establishment and to their business. In September 2017, James Dimon (CEO JPMorgan) was calling bitcoin a “fraud” used by “Murderers, drug dealers and North Koreans”, the vast majority of banks were advising their clients to stay away from Bitcoin.

Since then the tide has turned and most of the big banks are experimenting with Blockchain, including JPMorgan. We are even seeing the birth of crypto banks in Switzerland, holding a banking license and regulated by the FINMA. Traditional payment players are also heavily investing in Blockchain, Alfred Kelly (VISA CEO) mentioned earlier this month (Nov 2020) that : “Crypto is a developing part of payments in the world. It’s in the very nascent state right now, and we’re very interested in cryptocurrencies” (link). On their side PayPal has enabled their vast user base to buy, hold and sell cryptocurrencies in October 2020 (link), which represents a serious step towards mainstream adoption.

Although efforts have been made towards regulation and adoption, what remained from the early years is the noticeable volatility of the crypto currencies’ prices. From the height of around $20,089.00 USD on Dec 17, 2017 the price had fallen to $3212.12 by Dec 14, 2018 and then raised back to $19,312.39 by end of November 2020, offering a roller-coaster of emotions to the coin’s holders. 

But what exactly defines the price of this electronic asset and what drives the steep raises and falls of its price? In short, the price of bitcoin can be assessed by multiple ways, from the price dictated by market’s offer and demand on the exchanges to the “fundamental” price that could be calculated by taking into account the cost of producing a bitcoin.

One of the established hypothesis is that the cryptocurrency market is heavily influenced by crowd trends, news and social medias. Big swings in the price can be observed when news are released on social medias concerning potential regulations or hacks. As a result, there is an increasing interest to develop and leverage machine learning techniques to detect in advance such swings and capitalize on those to make profit trading the cryptocurrency.

In this document we will first explore the nature of bitcoin and its price and then explain our approach concerning the building of our very own sentiment analysis solution.

2 What is Bitcoin

2 a. Bitcoin at a glance

The best way to describe bitcoin would be probably to present it in the light of its white paper, released to the world by Satoshi Nakamoto in 2008 (link). Satoshi Nakamoto presented Bitcoin as “a peer to peer electronic cash system”. The main goal of the currency is to be an electronic version of “cash” that would allow online payments to be sent peer to peer directly, without sending it first through a financial institution. The rationale behind the paper was that as the transactions booked via a financial institution are reversible and since those financial institutions have to mediate disputes between actors in the network, the costs of those transactions are necessarily high. Thus, limiting the minimum size of the transactions and limiting the trust of each party involved in online transactions. Satoshi proposed a new electronic payment system, based on cryptographic proof instead of trust. Two willing parties would interact directly with each other without the need of a trusted party as a middle man. The transactions would be recorded in a permanent electronic ledger, without any possibility to reverse them, protecting the sellers from fraud. The solution would offer a solution to the double-spending problem by using a peer-to-peer distributed timestamp server to generate computational proof of the chronology of the transactions, as long as more than 50% of the nodes are honest and control more CPU power than a potential group of hostile actors.

What is Blockchain Technology? A Step-by-Step Guide For Beginners
Source of illustration : blockgeeks

Bitcoin offers three popular incentives to its users:

The first one is that Bitcoin is open-source, it’s design is public and nobody owns or controls Bitcoin and everyone can take part in the eco system(link). Privacy and decentralizations have been topics growing in importance in the last decades. Users data have been exposed and illegally accessed at countless iterations, whether it is through global corporations being hacked (link) or through global surveillance piloted by governments. According to Edward Snowden the NSA has been hacking into private and public communications for more than a decade, (link). In addition, we have also witnessed occurrences where centralized institutions simply sized the assets of the users or citizens, for instance in Cyprus where the funds of the citizens were simply confiscated by the government, no insured deposit of €100,000 or less were affected, though 47.5% of all bank deposits above €100,000 were seized (link). This issues have nurtured a growing distrust towards centralized institutions and favoured the emergence of decentralized alternatives, where no central government or private company holds absolute power and where the users are the driving force. In addition, bitcoin can offer a good alternatives to traditional currencies for citizens of countries experiencing high inflation, we have witnessed a raise of bitcoin’s popularity in Venezuela lately, as the country is facing a heavy depreciation of the Venezuelan bolivar. Facing hyperinflation the country is turning to cryptocurrency adoption due to a combination of factors including migration, capital controls, risk of government seizure and exposure to petrol price, link.

The second incentive is that Bitcoin and crypto currencies offers an alternative way of investing and earning money. Through mining, anyone with a functioning laptop, or any device capable of computing power (link),  can plug in and become a miner. In a nutshell, miners are the validators of the transactions of the bitcoin network, they lend their computational power to solve cryptographic puzzles and validate transactions and in return they are rewarded with freshly minted bitcoins as an incentive. Today most of the market is dominated by a few big players, but anyone can virtually join of the pools and start earning bitcoin by mining.

These 5 Bitcoin Mining Pools Account for 70% of Bitcoin Hashrate  Distribution - Bitrazzi

New generations are also interested in alternative ways of investing their capital. The time where banks were all-mighty asset managers is slowly fading. New access to education through internet and the democratization of smaller players offering new innovative ways for investors to earn interest have offered viable alternatives to the banker. Especially with the raise of DeFi (decentralized finance), new options such as yield farming, crypto lending and staking have offered staggering returns in comparison to traditional asset classes. Very high volatility and a tremendous raise in the price of bitcoin has also offered good returns to bitcoin’s investors. According to www.intotheblock.com, as of Today (30.11.2020) more than 95% of people who have bought BTC and held on it are in profit, as shown in the illustration below. 

The meteoritic climb of the price of bitcoin and natural prowess to communicate through social medias has given even more appeal to the currency for the newer generations, eager to find new digital ways to invest their money.

Finally, the third reason would be Financial inclusion. According to the World bank, 53% of the worlds’ adult population is unbanked, McKinsey & Company agrees with this statement : “Half of the world is unbanked”. This population does not have access to a regular checking account and even less to a payment card or a credit card. Cryptocurrencies and Bitcoin offer an alternative to this population, everybody with a smartphone or even a regular phone can hold an account and operate peer to peer payments, without having to open a bank account with a regulated entity. Opening new ways to lend and finance your own business.

2 b. Bitcoin – Difference with traditional assets

Marc Andreessen, an internet pioneer and investor famously said that “Software is eating the world” in 2011. Since then we can only agree with Marc seeing how the world has digitized and how  the companies that embraced software in 2011 are the current market leaders in their respective fields, no surprise that the top 5 market capitalization companies worldwide are all offering some type of software solutions.

We can see today that this maxim is also relevant for Bitcoin and crypto currencies as a whole. A share represents a partial ownership in a company, a bond is a debt but Bitcoin does not represent any underlying asset. So what is it ?

It is useful to first point out that as Bitcoin does not need any intervention from traditional financial institutions such as banks or clearing houses, the transactions can therefore be created and processed anywhere and anytime, providing business flexibility (link). Most brokers can only process transactions during working hours, making it difficult to book your trades on your favourite ticker during the weekend for instance. Bitcoin can be traded in the night and from any device.

It can be noted as well that Bitcoins are not being issued by a central authority, they are generated through a mining process and as such they have a predicable growth rate and are completely independent from the traditional eco systems. The limited supply of 21 million bitcoins can also be seen as an advantage to hedge against inflation. The predictability of the supply, the issuance and the cryptographic trust mechanism are all parameters that distinguish Bitcoin from traditional currencies or investment vehicles.

We can also observe a very high volatility in comparison to other traditional investment vehicles or currencies. This volatility can represent an additional risk for investors, and should be taken into account. An investor buying bitcoins must be prepared for big swings in the value of his portfolio. As mentioned in the previous section, the price of bitcoin has moved from $20,000 to $3,400 and then back to $19,000 over the span of the last three years. It should be noted that according to Daniel Kahneman in his book “Thinking, fast and slow” humans are more sensible to losses than gains and that as a consequence such big dents in the portfolio can outweigh the gains in the perspective of the investor.

We can also cite the fact that as Bitcoin is not backed by a central authority, it is difficult to retrieve lost funds due to human error or hacks. In the case where the private address of an investor is compromised and all Bitcoins siphoned out of the wallet, it is simply impossible to reverse the transaction due to the very nature of Bitcoin. It is then quite difficult to identify the thief and to retrieve the Bitcoins. The maxim “not your keys, not your coins” is especially interesting in the subject of the security of internet exchanges, where your coins are stored in the wallets of the exchange and as such susceptible to hacks if security problems arise. We can offer the famous case of the hack of MtGox as an example to this point, link.

Bitcoin is usually defined as a “crypto currency” or a “digital currency”. A currency is usually answering the following specific functions :

  • A medium of exchange
  • A unit of account
  • Store of value 

If we have a look at the three functions in regards to bitcoin, it becomes quite clear that Bitcoin is not a great medium of exchange. Data from chainalysis in 2018 indicated that most investors do not use Bitcoin as a medium of exchange but rather see it as an investment tool. The fees linked to every transaction, the fact that the transactions first need to be validated before being effective and the extreme volatility of the price are all factors limiting the usage of bitcoin as a real mainstream medium of exchange. The current pricing of bitcoin makes it also difficult to use as a unit of account. If we want to buy a pizza today with bitcoin, would the price 0.0012 BTC (CHF 20) be self-explanatory to the average consumer ?

In the end research are more or less in consensus to affirm that Bitcoin is more a store of value and as such rather an investment vehicle than a currency (Baur et al. 2015, Yermack 2013).

Integrating BTC into the asset portfolio can be interesting from multiple angles, according to Ria Bhutoria, director of research at fidelity digital assets, link:

  • Potential : “Bitcoin is only at its beginning, with its $197 billion market cap (October 7, 2020), it is only a drop in the bucket compared with markets bitcoin could disrupt.” Bitcoin represents very high expected risk-adjusted returns
  • Correlation : Fidelity’s report showcases that bitcoin’s behaviour is decoupled from other assets such as stocks or gold. “Bitcoin is fundamentally less exposed to the prolonged economic headwinds that other assets will likely face in the next months and years. Combined with its multifaceted narratives and an interesting effect of persisting retail and growing institutional sentiment, it could be a potentially useful and uncorrelated addition to an investor’s portfolio toolkit.”. Indeed, as bitcoin is not issued by a central bank or backed by a government, therefore the monetary policy, inflation rates and economic growth measurements that typically influence the value of a currency simply do not apply to bitcoin.
  • Fees : “Alternative investments may be accompanied by fees that reduce the net returns investors receive such as management and performance fees”. This is not the case with bitcoin as the only fees associated with it are the transaction fees linked to the execution of transactions and the eventual custody fees.
  • Other noticeable advantages : Diversification, Liquidity, Accessibility.

Today, market leaders and public figures openly advise most investors to hold at least a small position in Bitcoin, as insurance. Fidelity advises its investors to hold 5% of their portfolio in Bitcoin (link), a Yale study advises that an optimal portfolio should include at least 6% of BTC (link). We can also cite Virgin galactic CEO, Chamath Palihapitiya who thinks investors should put a small percentage of their net worth in Bitcoin, around 1%, link.

As a validation of this investment strategy we can witness today more and more asset managers including BTC positions into their portfolio, validating the reasons mentioned above. Here are a few examples :

  • Stone Ridge Asset Management acquires $115 Million of bitcoin, link
  • MicroStrategy raises bitcoin holdings to $425 Million after second purchase, link
  • Square buys $50 Million in bitcoin, link

2 c. Other incentives to invest into crypto currencies and blockchain

We have seen in the previous section how Bitcoin was slowly being accepted as a traditional investment vehicle as even traditional asset managers are slowly building up BTC positions.

When mentioning Bitcoin and cryptocurrencies in the context of investment. We should also at least dedicate a small section to the new investment opportunities offered by blockchain. We discussed already Bitcoin as a store of value and speculative investment vehicle, but what about DeFi ?

DeFi means “decentralized finance”, it is an umbrella term for a wide array of financial applications targeted at using Blockchain and DLT technologies to offer services traditionally offered by centralized financial institutions.

 Traditional Financial SystemDecentralized Finance
AccessibilityAccessible to clients of the firm onlyAccessible with anyone with an internet connection
ComposabilitySiloed products and servicesProducts can be mixed and matched without any friction and new products can natively be built on top of existing ones
TransparencyProducts are developed in-house and proprietary. Customers have no ability to see the underlying code nor technologyEverything is open-source. Independent verification and driver of fast technological progress
GovernanceDecisions taken by centralized structureDecentralized and transparent decision making by the community (developers and users)

The traction in DeFi is absolutely staggering, validating the appetite for alternative ways to use traditional financial tools in a decentralized context

Source : defipulse
source : defipulse

In order to make things tangible, let’s showcase a few projects in the Defi space that offer concrete applications :

Uniswap : “Uniswap is basically a set of computer programs that run on the Ethereum blockchain and allow for decentralized token swaps. Traders can exchange Ethereum tokens on Uniswap without having to trust anyone with their funds (i.e. exchanges). Meanwhile, anyone can lend their crypto to special reserves called “liquidity pools”. In exchange for providing money to these pools, they earn fees (i.e. yield farming)” source : link.

MakerDAO : MakerDAO is a decentralized organization built on Ethereum that allows lending and borrowing of cryptocurrencies without the need of an intermediary. MakerDAO is a set of smart contracts services that manage borrowing and lending through two currencies : DAI and MKR. By combining loans with a stable currency (DAI), MakerDAO allows anyone to borrow money and reliably predict how much they have to pay back. Lenders are rewarded with interest and borrowers have access to new capital.

As we can see from the two examples mentioned above, the DeFi space is truly offering alternatives to services traditionally trusted by banks. In Fine, let’s conclude by mentioning that according to the UBS global family office report from 2019, 57% [of the surveyed family offices] believe blockchain technology will fundamentally change the way we invest in the future.


Brax

Dude in his 30s starting his digital notepad