Saisrinivas_Ambatipudi_Final_Project - Analysis of Cryptocurrency Data
Author
Saisrinivas Ambatipudi
Published
December 20, 2022
Introduction
Cryptocurrencies, the word makes people curious about what it is, why is so important, what kind of role does it play in the society. But cryptocurrencies are nothing but money which stored in digital format and it is designed to be an exchange medium whose records are saved on that digital format on something called the blockchain and smart contracts. But we can talk about blockchain and smart contracts in a different topic altogether.
The term cryptocurrencies first came to be in the early 2010’s as a form of digital assets and has now caused an economic boom where people who had invested back in the day are present day billionaires now.
These digital assets are the talk of the town and this project we will find out how cryto currencies started out and developed in prices and market capitalization.
The dataset was extracted from Kaggle.
About the Dataset
In this project we have a data set about with about 20 different crytpo currencies including bitcoin, ethereum, solana, tether, etc., and it has the following features as well:
1.Currency 2.Date 3.Open (Opening Price) 4.High (Highest price of the crypto that day) 5.Low (Lowest price of the crypto that day) 6.Close (Closing Price) 7.Volume (Total Volume of coins traded by day) 8.Market Cap (Total Market Value of the coin by day)
My research question:
In this project we want to vizualize the 23 different crypto-currenices in a time series, where we can see the respective crypto-currency along with its open, close, high and low prices and values based on the dates.
And we will also compare Bitcoin with tether in terms of prices and volume and find out: - which coin dominated in which years in terms of market capitalization. - the different prices of the cryptocurrencies from the years 2017 to 2021 because thats when these digital assets became a super hit. - Why Bitcoin’s volume decreased during 2020-2021 while tether’s volume kept increasing?
The full Dataset
crypto <-read_csv("_data/crypto_maa2.csv")
Rows: 37082 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Currency, Date
dbl (6): Open, High, Low, Close, Volume, Marketcap
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Here we get the summary of the data set where we can check the full features of each and every column.
We can see that the highest price any cryptocurrency has is 64863.10 and the lowest is 62208.96.
And the highest market cap is 1186360000000. Which is $1,186,360,000,000. That is a huge amount of money. This value would most likely be for bitcoin as its has the highest value in the market till date.
Currency Date Open High
Length:37082 Min. :2013-04-29 Min. : 0.00 Min. : 0.00
Class :character 1st Qu.:2017-03-05 1st Qu.: 0.07 1st Qu.: 0.08
Mode :character Median :2019-01-09 Median : 1.00 Median : 1.01
Mean :2018-08-15 Mean : 985.32 Mean : 1016.06
3rd Qu.:2020-05-13 3rd Qu.: 30.46 3rd Qu.: 31.92
Max. :2021-07-06 Max. :63523.75 Max. :64863.10
Low Close Volume Marketcap
Min. : 0.00 Min. : 0.00 Min. :0.000e+00 Min. :0.000e+00
1st Qu.: 0.07 1st Qu.: 0.07 1st Qu.:4.937e+06 1st Qu.:2.396e+08
Median : 1.00 Median : 1.00 Median :8.513e+07 Median :1.405e+09
Mean : 952.99 Mean : 987.12 Mean :3.022e+09 Mean :1.543e+10
3rd Qu.: 29.00 3rd Qu.: 30.51 3rd Qu.:9.388e+08 3rd Qu.:5.159e+09
Max. :62208.96 Max. :63503.46 Max. :3.510e+11 Max. :1.190e+12
Year
Min. :2013
1st Qu.:2017
Median :2019
Mean :2018
3rd Qu.:2020
Max. :2021
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
Prices, Market Values and Volume of the digital assets.
In this visualization we will go ahead and check the opening prices and the closing prices in the plot. It will be clearly shown that the prices of all currencies didn’t start picking up until the later half of 2017. The were a few interesting coins that picked up in the later half of 2017 and died down quickly after the first two years that is was introduced to the financial markets because of this.
The cause of the sudden surge in interest in Bitcoin in the middle of 2017 is still a mystery, but it is wildly speculative that a single whale artificially inflated the price of Bitcoin, sparking a surge in demand for the currency on a massive scale. As a result, the financial world began to take an interest in digital currencies, and the prices of practically all currencies increased, with Bitcoin emerging as the strongest and most well-liked currency in the field.
We need to make a visualization to get the market values for all the coins to make it easier to navigate through the data. The data set will be divided into 23 subsets of each currency.
As The subsetted data is in the form ‘OHLC’ (open,High,Low,Close) it is in the ideal format to work with the Quantmod library and hence is converted to XTS type.
Now we talk a look at the the price series of the cryptocurrencies.
First we will combine the time-series data into one singe data frame for easier plotting.
combined_df <-merge(Bitcoin, Ethereum, by ="Date")
Warning in merge.xts(Bitcoin, Ethereum, by = "Date"): NAs introduced by coercion
Warning in merge.xts(Bitcoin, Ethereum, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, Aave, by ="Date")
Warning in merge.xts(combined_df, Aave, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, Aave, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, Cardano, by ="Date")
Warning in merge.xts(combined_df, Cardano, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Cardano, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, Chainlink, by ="Date")
Warning in merge.xts(combined_df, Chainlink, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Chainlink, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, Cosmos, by ="Date")
Warning in merge.xts(combined_df, Cosmos, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Cosmos, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, Dogecoin, by ="Date")
Warning in merge.xts(combined_df, Dogecoin, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Dogecoin, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, EOS, by ="Date")
Warning in merge.xts(combined_df, EOS, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, EOS, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, Ethereum, by ="Date")
Warning in merge.xts(combined_df, Ethereum, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Ethereum, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, IOTA, by ="Date")
Warning in merge.xts(combined_df, IOTA, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, IOTA, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, Litecoin, by ="Date")
Warning in merge.xts(combined_df, Litecoin, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Litecoin, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, Monero, by ="Date")
Warning in merge.xts(combined_df, Monero, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Monero, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, NEM, by ="Date")
Warning in merge.xts(combined_df, NEM, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, NEM, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, XRP, by ="Date")
Warning in merge.xts(combined_df, XRP, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, XRP, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, Polkadot, by ="Date")
Warning in merge.xts(combined_df, Polkadot, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Polkadot, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, Stellar, by ="Date")
Warning in merge.xts(combined_df, Stellar, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Stellar, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, Tether, by ="Date")
Warning in merge.xts(combined_df, Tether, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Tether, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, TRON, by ="Date")
Warning in merge.xts(combined_df, TRON, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, TRON, by = "Date"): NAs introduced by coercion
combined_df <-merge(combined_df, Uniswap, by ="Date")
Warning in merge.xts(combined_df, Uniswap, by = "Date"): NAs introduced by
coercion
Warning in merge.xts(combined_df, Uniswap, by = "Date"): NAs introduced by
coercion
combined_df <-merge(combined_df, XRP, by ="Date")
Warning in merge.xts(combined_df, XRP, by = "Date"): NAs introduced by coercion
Warning in merge.xts(combined_df, XRP, by = "Date"): NAs introduced by coercion
combined_df[is.na(combined_df)] <-0
And then we will plot the data in a line graph, we will reduce bitcoin’s opening price by 1000 to see the other prices more clearly.
ggplot(combined_df, aes(x =index(Bitcoin), y = BitcoinOpen/100, color ="Bitcoin")) +geom_line() +ggtitle("Crypto Opening price series") +theme(legend.position ="top") +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust=1)) +labs(x ="Date",y ="Opening Prices",color ="Currencies",caption ="Sai") +scale_x_date(date_labels ="%b %y", date_breaks ="6 months") +theme(plot.title =element_text(hjust =0.5)) +theme(plot.subtitle =element_text(hjust =0.5)) +theme(legend.key.width =unit(2,"cm"))+geom_line(aes(y = EthereumOpen, color ="Ethereum"))+geom_line(aes(y = AaveOpen, color ="Aave"))+geom_line(aes(y = CardanoOpen, color ="Cardano"))+geom_line(aes(y = ChainlinkOpen, color ="Chainlink"))+geom_line(aes(y = CosmosOpen, color ="Cosmos"))+geom_line(aes(y = DogecoinOpen, color ="Dogecoin"))+geom_line(aes(y = EOSOpen, color ="EOS"))+geom_line(aes(y = IOTAOpen, color ="IOTA"))+geom_line(aes(y = LitecoinOpen, color ="Litecoin"))+geom_line(aes(y = MoneroOpen, color ="Monero"))+geom_line(aes(y = NEMOpen, color ="NEM"))+geom_line(aes(y = PolkadotOpen, color ="Polkadot"))+geom_line(aes(y = StellarOpen, color ="Stellar"))+geom_line(aes(y = TetherOpen, color ="Tether"))+geom_line(aes(y = TRONOpen, color ="TRON"))+geom_line(aes(y = UniswapOpen, color ="Uniswap"))+geom_line(aes(y = XRPOpen, color ="XRP"))
From the line graph above we can see that the price of bitcoin rose in 2017 and the dropped and almost all the crytocurriences had the same trend until 2021 where they skyrocketted.
Market Capitalization
Now we will check the total market capitalization in a the same line graph format.
ggplot(combined_df, aes(x =index(Bitcoin), y = BitcoinMarketcap/100000000, color ="Bitcoin")) +geom_line() +ggtitle("Crypto Market Cap") +theme(legend.position ="top") +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust=1)) +labs(x ="Date",y ="Total Mean Capital",color ="Currencies",title ="Crypto Market Capitalization",subtitle ="in 100 millions", caption ="Sai") +scale_x_date(date_labels ="%b %y", date_breaks ="6 months") +theme(plot.title =element_text(hjust =0.5)) +theme(plot.subtitle =element_text(hjust =0.5)) +theme(legend.key.width =unit(2,"cm"))+geom_line(aes(y = EthereumMarketcap/100000000, color ="Ethereum"))+geom_line(aes(y = AaveMarketcap/100000000, color ="Aave"))+geom_line(aes(y = CardanoMarketcap/100000000, color ="Cardano"))+geom_line(aes(y = ChainlinkMarketcap/100000000, color ="Chainlink"))+geom_line(aes(y = CosmosMarketcap/100000000, color ="Cosmos"))+geom_line(aes(y = DogecoinMarketcap/100000000, color ="Dogecoin"))+geom_line(aes(y = EOSMarketcap/100000000, color ="EOS"))+geom_line(aes(y = IOTAMarketcap/100000000, color ="IOTA"))+geom_line(aes(y = LitecoinMarketcap/100000000, color ="Litecoin"))+geom_line(aes(y = MoneroMarketcap/100000000, color ="Monero"))+geom_line(aes(y = NEMMarketcap/100000000, color ="NEM"))+geom_line(aes(y = PolkadotMarketcap/100000000, color ="Polkadot"))+geom_line(aes(y = StellarMarketcap/100000000, color ="Stellar"))+geom_line(aes(y = TetherMarketcap/100000000, color ="Tether"))+geom_line(aes(y = TRONMarketcap/100000000, color ="TRON"))+geom_line(aes(y = UniswapMarketcap/100000000, color ="Uniswap"))+geom_line(aes(y = XRPMarketcap/100000000, color ="XRP"))
The market capitalisation of Bitcoin throughout time is depicted in the plot below. It’s interesting to note that in the beginning, in terms of market capitalization, Bitcoin and Ethereum were practically equal. But as Bitcoin became more and more well-known over time, its value multiplied.
As previously noted, it is still somewhat unclear what caused the unexpected interest and growth in the value of digital currencies 10 years after their creation, including that of Bitcoin past 2017. However, some of the primary factors are as follows:
The regulation of digital currencies is not very strict: Digital currencies are unregulated, in contrast to fiat currencies like the US Dollar or the Euro, which means that no central bank or specific government of any country has as much authority over them as they do over other financial products.
Remember that the world was experiencing the 2008 banking crises when “Satoshi Nakamoto,” the person who invented Bitcoin, wrote the code that enabled it to exist back in 2009. The need for an alternative to fiat currencies, which were subject to heavy regulation and the speculative dynamics of the financial markets, led to the creation of digital currencies.
They are very discrete: Compared to bank accounts or other forms of money storage, cryptocurrencies provide a lot more privacy. The alpha-numeric account numbers or “addresses” of cryptocurrencies are used as pointers to digital wallets and are unrelated to the personal data of the organization or person who owns the wallet. thereby offering a considerably stronger sense of protection against fraud and financial watchdog rules than traditional currencies.
Only twenty million Bitcoins are available at any given time, which is a fairly small and consistent supply for this particular currency. Unlike traditional currencies, Bitcoins cannot be produced indefinitely in a money mint after a major natural disaster or a financial crisis. This not only increases the value of the existing Bitcoins over time but also lends consistency to their monetary values.
Price Indicators of all the currencies.
Here in this visualization below we will check the prices of all the crypto currencies from 2017 to 2021
The volume traded data from 2017 onward is shown here because there was scarcely any interest in digital currency before to that year. It is clear that after the middle of 2017, there was an increase in market interest, which led to significant volume being traded on international financial markets.
Although Tether’s price range (96 cents to $1.04 vs. 4k to 18k for Bitcoin) and market capitalization are vastly different from those of Bitcoin, it is also extremely fascinating to notice that Tether rivals and occasionally surpasses Bitcoin in terms of trading volume.
ggplot(combined_df['2017-08/'], aes(x =index(Bitcoin['2017-08/']), y = BitcoinVolume['2017-08/']/100000000, color ="Bitcoin")) +geom_line() +ggtitle("Traded Crypto") +theme(legend.position ="top") +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust=1)) +labs(x ="Date",y ="Total Mean Volume",color ="Currencies",title ="All crypto traded",subtitle ="in 100 millions", caption ="Sai") +scale_x_date(date_labels ="%b %y", date_breaks ="6 months") +theme(plot.title =element_text(hjust =0.5)) +theme(plot.subtitle =element_text(hjust =0.5)) +theme(legend.key.width =unit(2,"cm"))+geom_line(aes(y = EthereumVolume/100000000, color ="Ethereum"))+geom_line(aes(y = AaveVolume/100000000, color ="Aave"))+geom_line(aes(y = CardanoVolume/100000000, color ="Cardano"))+geom_line(aes(y = ChainlinkVolume/100000000, color ="Chainlink"))+geom_line(aes(y = CosmosVolume/100000000, color ="Cosmos"))+geom_line(aes(y = DogecoinVolume/100000000, color ="Dogecoin"))+geom_line(aes(y = EOSVolume/100000000, color ="EOS"))+geom_line(aes(y = IOTAVolume/100000000, color ="IOTA"))+geom_line(aes(y = LitecoinVolume/100000000, color ="Litecoin"))+geom_line(aes(y = MoneroVolume/100000000, color ="Monero"))+geom_line(aes(y = NEMVolume/100000000, color ="NEM"))+geom_line(aes(y = PolkadotVolume/100000000, color ="Polkadot"))+geom_line(aes(y = StellarVolume/100000000, color ="Stellar"))+geom_line(aes(y = TetherVolume/100000000, color ="Tether"))+geom_line(aes(y = TRONVolume/100000000, color ="TRON"))+geom_line(aes(y = UniswapVolume/100000000, color ="Uniswap"))+geom_line(aes(y = XRPVolume/100000000, color ="XRP"))
As expected, the graphical illustration below demonstrates that in 2020 and in 2021, Tether currency traded at a bigger volume on the financial markets than Bitcoin.
The project goes on to investigate the causes of this as well as the relationships between the market capitalization and volume of trading of the two currencies.
Bitcoin$Year =as.numeric(format(index(Bitcoin),"%Y"))Tether$Year =as.numeric(format(index(Tether),"%Y"))Vol_yrly_BT =aggregate(BitcoinVolume ~ Year, data=Bitcoin , FUN= mean)Vol_yrly_TT =aggregate(TetherVolume ~ Year, data=Tether , FUN= mean)Vol_yrly_combined =merge(Vol_yrly_BT, Vol_yrly_TT, by="Year")# Merge the data for Bitcoin and Tether into a single data framemerged_data <-merge(Vol_yrly_BT, Tether, by ="Year")# Create the plot using the merged dataplot_ly(merged_data, x =~Year ,y =~BitcoinVolume, type ='bar',name ='Bitcoin Volume',marker =list(color ='rgb(49,130,189)')) %>%add_trace(y =~TetherVolume, name ='Tether Volume',marker =list(color ='rgb(204,204,204)')) %>%layout(title ='Yearly Volume Traded by Bitcoin & Tether',xaxis =list(title ='Years',tickangle =-45),yaxis =list(title ='Total Volume Traded'),margin =list(b=100),barmode ='group')
Distribution and Correlation of the Volume
The distribution of the volume variable for the currencies Tether and Bitcoin is shown in the graphs below. The graph clearly shows that it is a right-skewed distribution. They are both positively skewed, in other words. The data’s means and standard deviations are also noted.
That mean is far lower than the median in both cases, as can be seen quite plainly. This may indicate that the left side of the data contains many outliers.
Now we check the correlation between the volume of tether and bitcoin.We investigate the relationship between market capitalization and volume traded for the currencies Tether and Bitcoin in the plot below. Both currencies display a positive correlation between their volume of trades and market capitalization, with Tether displaying a larger correlation of 0.64 and Bitcoin displaying a relatively smaller, but still very strong correlation of 0.56.
In essence, this indicates that the Market Capitalization of other currencies—more specifically, Tether than Bitcoin—directly affects the volume of trading. Which is not very surprising given that, among other factors, the level of public trust has a significant impact on a product’s or company’s market value. For instance, when news broke that Mordena and other pharmaceutical companies had perhaps discovered a vaccine for COVID-19, their stock values skyrocketed. despite the fact that there was initially no evidence or definitive tests.
We are still trying to figure out why Tether trades at volumes that are practically identical to those of Bitcoin, despite being so far behind on every other metric.
The closing prices of the two currencies, as depicted in the graph below, provide the answers to the aforementioned question.
The volatility of Bitcoin’s price is one of the main causes of the high levels of trading trust in Tether. As you can see from the graph below, Bitcoin’s price has decreased from more than 4000 to approximately upwards of 18000 in just two years. The price difference in the instance of Tether, however, has not exceeded a measly 6 cents.
The base price of the stock is another factor in Tether’s high trading volume. Tether’s pricing is so low that it allows both low risk mutual fund companies and those who aren’t big investors to enter the market for digital currencies without taking on too much risk. But compared to Bitcoin, this also results in very little reward because reward is always inversely correlated with risk.
This does raise the question of why Tether and not another currency that competes with Bitcoin and has a low base price and low price volatility. The only cryptocurrency that is backed by US dollars is Tether, which is the solution to this query. Investor confidence in the stock is increased because no other currency is backed by real money.
bitcoin_close =plot_ly(as.data.frame(Bitcoin2021),y =~BitcoinClose, x =~index(Bitcoin2021), type ='scatter',mode ='lines',name ='Bitcoin Closing Price') %>%layout(xaxis =list(title ='Years',tickangle =-45,tickfont =list(size =10)),yaxis =list(title ='Price Range',tickfont =list(size =10)))tether_close =plot_ly(as.data.frame(Tether2021),y =~TetherClose, x =~index(Tether2021), type ='scatter',mode ='lines',name ='Tether Closing Price') %>%layout(xaxis =list(title ='Years',tickangle =45,tickfont =list(size =10)),yaxis =list(title ='Price Range',tickfont =list(size =10)))subplot(bitcoin_close, tether_close) %>%layout(title="Closing Prices of Bitcoin and Tether",font =10)
Conclusion:
We have successfully analyzed the crytocurrencies and to conclude my analysis:
We have found out which coin dominated the market based on the year. 2013 - There were only 4 digital assets on the market, so BITCOIN dominated by 93.4%. 2014 - The was an addition of 2 more digital assets to the market but BITCOIN still dominated by 93.7%. A 0.4 increase in market capitalization mean the volume of the coins were increasing. 2015 - BITCOIN still dominated but there was an addition of 3 more digital assets which let to market cap of BITCOIN dropping to 89.7% and XRP having 6.94% of the market share 2016 - No new cryptocurrencies were added but the market capitalization of BITCOIN decreased to 87% and we can see other digital assets climbing up like ethereum taking 7.82% of the market. 2017 - This year is where the crypto boom happened and we can see that new digital assets were added and ethereum took 20.1% of the market and bitcoin dropped to 63.2% and XRP having 7.47 % 2018 - More coins added and BITCOIN dropped to 53% and ethereum had close to 20% while XRP had 10%. 2019 - BITCOIN made a comeback with taking 70% of the market share back from the other digital assets by taking 70% of the market. 2020 - Around 8-10 cryptocurrencies were introduced to the market but BITCOIN still maintained 71% market share. 2021 - BITCOIN had 60% of the market share, 17% was ethereum’s and there were more crypto currencies made that year.
Using the Price vizualization above with the drop down of different cryptocurrencies we see that:
We see that BITCOIN’s prices are mostly outliers due to the heavy rise from the years 2017 - 2021
Ethereum also competes with the market capitalization but not as much as BITCOIN.
Other Crypto currencies had less market share but due to their small prices and sudden gains and drops people gained and lost a lot of money, hence they did have major volatility making it uninvestable.
Usually crypto currencies depend on the popularity for it price to increase.
Why Bitcoin’s volume decreased during 2020-2021 while tether’s volume kept increasing? Mostly due to the high volatility in the prices the volume decreased whereas tether had a stable prices hence the volume kept increasing.