What is a cryptocurrency? - A cryptocurrency is a digital asset designed to work as a medium of exchange using cryptography to secure the transactions, to control the creation of additional units, and to verify the transfer of assets. Cryptocurrencies are classified as a subset of digital currencies and are also classified as a subset of alternative currencies and virtual currencies. Bitcoin was the first decentralized cryptocurrency launched in 2009. This is the most famous cryptocurrency till date. It was developed by Satoshi Nakamoto as a decentralised electronic peer-to-peer cash system that does not require a centralised third party to approve transactions. (Source: Wikipedia)
Why cryptocurrency historical data analysis? - The cryptocurrency market is growing very rapidly and the price of the cryptocurrencies are setting new all time high records. Other than the well known Bitcoin, there are several other cryptocurrencies like Ethereum, Litecoin, Ripple etc. that are making headlines now a days. This project will deep dive into historical price of these cryptocurrencies to uncover the price patterns, compare different cryptocurrencies and provide visualizations to understand the trends. This project is developed as an academic project for the Data Wrangling in R course. The purpose of the project is to perform below activities:
Below are the packages used for this project:
Exploratory data analysis is performed on data comprising of historical price of 17 cryptocurrencies after importing and cleaning the data. Analysis is based on availability of historical data from various starting dates. Below is the summary of the observations:
Analysis using change in closing price between October 2017 and last week/month/quarter/year
Analysis using market cap of top 5 cryptocurrencies
Analysis using closing price of top 5 cryptocurrencies
Analysis using closing price of all cryptocurrencies
The aim of this analysis is to see some trends and visualizations for closing price and market cap among 17 cryptocurrencies. There are more than 1000 cryptocurrencies listed online and hence, this analysis is not comprehensive. Also, this analysis is not predictive and doesn’t answer the question “which is the best cryptocurrency to invest”!! Comprehensive analysis is required with additional data to predict the prices and identify best cryptocurrency to invest.
The cryptocurrency historical prices data are downloaded from Kaggle. There are 17 datasets each for a cryptocurrency that contains historical price information from different starting dates till October 3, 2017. Summary of these datasets is displayed in the sidebar. For analysis, the data for all cryptocurrencies is combined into a single dataframe. There are total 11522 observations and 8 variables for historical price of cryptocurrencies. The variables included are described as below:
| Crypto_Type | Date | Open | High | Low | Close | Volume | Market Cap |
|---|---|---|---|---|---|---|---|
| Bitcoin | Oct 03, 2017 | 4408.46 | 4432.47 | 4258.89 | 4317.48 | 1,288,020,000 | 73,181,300,000 |
| Bitcoin | Oct 02, 2017 | 4395.81 | 4470.23 | 4377.46 | 4409.32 | 1,431,730,000 | 72,963,200,000 |
| Bitcoin | Oct 01, 2017 | 4341.05 | 4403.74 | 4269.81 | 4403.74 | 1,208,210,000 | 72,047,300,000 |
| Bitcoin | Sep 30, 2017 | 4166.11 | 4358.43 | 4160.86 | 4338.71 | 1,207,450,000 | 69,136,600,000 |
| Bitcoin | Sep 29, 2017 | 4171.62 | 4214.63 | 4039.29 | 4163.07 | 1,367,050,000 | 69,219,200,000 |
| Bitcoin | Sep 28, 2017 | 4197.13 | 4279.31 | 4109.70 | 4174.73 | 1,712,320,000 | 69,633,200,000 |
| Bitcoin | Sep 27, 2017 | 3892.94 | 4210.05 | 3884.82 | 4200.67 | 1,686,880,000 | 64,579,200,000 |
| Bitcoin | Sep 26, 2017 | 3928.41 | 3969.89 | 3869.90 | 3892.35 | 1,043,740,000 | 65,161,000,000 |
| Bitcoin | Sep 25, 2017 | 3681.58 | 3950.25 | 3681.58 | 3926.07 | 1,374,210,000 | 61,061,100,000 |
| Bitcoin | Sep 24, 2017 | 3796.15 | 3796.15 | 3666.90 | 3682.84 | 768,015,000 | 62,954,300,000 |
There are total 10759 observations for historical price of cryptocurrencies. Below is summary of data by each cryptocurrency:
| Cryptocurrency | Price History Start Date | Price History End Date | # of Observations |
|---|---|---|---|
| Bitcoin | 2013-12-27 | 2017-10-03 | 1377 |
| Litecoin | 2013-12-27 | 2017-10-03 | 1377 |
| Ripple | 2013-12-27 | 2017-10-03 | 1377 |
| Dash | 2014-02-14 | 2017-10-03 | 1328 |
| Monero | 2014-05-21 | 2017-10-03 | 1231 |
| Nem | 2015-04-01 | 2017-10-03 | 917 |
| Ethereum | 2015-08-08 | 2017-10-03 | 788 |
| Waves | 2016-06-21 | 2017-10-03 | 470 |
| Ethereum Classic | 2016-07-25 | 2017-10-03 | 436 |
| Stratis | 2016-08-13 | 2017-10-03 | 417 |
| Neo | 2016-10-26 | 2017-10-03 | 343 |
| Bitconnect | 2017-01-20 | 2017-10-03 | 257 |
| Iota | 2017-06-13 | 2017-10-03 | 113 |
| Numeraire | 2017-06-24 | 2017-10-03 | 102 |
| Qtum | 2017-07-13 | 2017-10-03 | 83 |
| Omisego | 2017-07-16 | 2017-10-03 | 80 |
| Bitcoin Cash | 2017-08-02 | 2017-10-03 | 63 |
This analysis is done for cryptocurrencies that have 52 weeks of historical price data available. Hence, the cryptocurrencies launched in 2017 are excluded.
Ethereum witnessed maximum increase in market cap in 2017
| Cryptocurrency | % Increase in Market Cap in 2017 |
|---|---|
| Ethereum | 3945 |
| Ripple | 3187 |
| Litecoin | 1236 |
| Bitcoin | 372 |
| Bitcoin Cash | 11 |
Based on closing price:
Based on first difference transformation of closing price:
| Cryptocurrency | Standard Deviation of Change in Daily Closing Price |
|---|---|
| Bitcoin Cash | 59.94 |
| Bitcoin | 55.85 |
| Ethereum | 8.14 |
| Litecoin | 1.38 |
| Ripple | 0.01 |
Bitcoin Cash showed maximum standard devaition in daily closing price change. This is in line to trend analysis where we see steep rise and fall in prices. Also, the differenced time series graph shows many fluctuations.
Ripple has least standard devaition in daily closing price change.
The difference series is examined to identify the increments. It is obtained from differences in successive observations between each day. Below are the plots for first difference transformations of closing price of top 5 cryptocurrencies:
Based on closing price trend analysis, below are the observations
Sharp Decreasing Trend in Closing Price
Both of these cryptocurrecies are new in the market launched in 2017.
Sharp Increasing Trend in Closing Price
Only Omisego among aboe is new in market launched in 2017.
Overall Increasing Trend with Intermediate Fluctuations Closing Price
Overall Same Closing Price with Volatile Intermediate Fluctuations
Both of these cryptocurrecies are new in the market launched in 2017.
---
title: "Cryptocurrency Market"
author: "Sarita Maharia"
output:
flexdashboard::flex_dashboard:
social: menu
source_code: embed
theme: yeti
---
```{r setup, include=FALSE}
library(flexdashboard)
library(stringr)
library(dplyr)
library(tidyr)
library(DT)
library(rvest)
library(data.table)
library(Hmisc)
library(lubridate)
library(ggplot2)
library(bit64)
library(knitr)
library(plotly)
library(TTR)
```
About This Project {data-navmenu="About" data-orientation=rows}
===============================================================================
column
-------------------------------------------------------------------------------
### **Introduction**
* **What is a cryptocurrency?** - A cryptocurrency is a digital asset designed to work as a medium of exchange using cryptography to secure the transactions, to control the creation of additional units, and to verify the transfer of assets. Cryptocurrencies are classified as a subset of digital currencies and are also classified as a subset of alternative currencies and virtual currencies.
Bitcoin was the first decentralized cryptocurrency launched in 2009. This is the most famous cryptocurrency till date. It was developed by Satoshi Nakamoto as a decentralised electronic peer-to-peer cash system that does not require a centralised third party to approve transactions.
(Source: Wikipedia)
* **Why cryptocurrency historical data analysis?** - The cryptocurrency market is growing very rapidly and the price of the cryptocurrencies are setting new all time high records. Other than the well known Bitcoin, there are several other cryptocurrencies like Ethereum, Litecoin, Ripple etc. that are making headlines now a days. This project will deep dive into historical price of these cryptocurrencies to uncover the price patterns, compare different cryptocurrencies and provide visualizations to understand the trends. This project is developed as an academic project for the Data Wrangling in R course. The purpose of the project is to perform below activities:
+ Importing Data
+ Cleaning Data
+ Performing Exploratory Data Analysis
### **Packages Used**
Below are the packages used for this project:
* flexdashboard: For creating interactive dashboard
* stringr: For strings manipulation
* dplyr: For data manipulation
* DT: For displaying data on screen in a scrollable format
* rvest: For HTML manipulation, required to scrape data from website
* data.table: For importing data
* Hmisc: For capitalizing first alphabet of each word in a string
* lubridate: For date manipulation
* ggplot2: For data visualizations
* bit64: For handling large integers that can't be handled with 32 bit data types
* plotly: For interactive data visualizations
* TTR: For handling time series data
column {data-height=600}
-------------------------------------------------------------------------------
### **Summary**
Exploratory data analysis is performed on data comprising of historical price of 17 cryptocurrencies after importing and cleaning the data. Analysis is based on availability of historical data from various starting dates. Below is the summary of the observations:
**Analysis using change in closing price between October 2017 and last week/month/quarter/year**
* October 2017 saw general decrease in closing price of cryptocurrencies.
* Maximum quaterly increase in closing price is visible for Monero followed by Bitcoin and Dash.
* Stratis fell most in term of quaterly price followed by Ethereum Classic and Ripple.
* All cryptocurrencies soared in 2017.
* Maximum annual increase in closing price is observed for Stratis. It was launched in 2016 with very small price in comparison to 2017 price.
* Only Bitcoin and Ethereum Classic saw less than 1000% growth in annual change in closing price.
**Analysis using market cap of top 5 cryptocurrencies**
* Maximum increase in market cap is witnessed in 2017.
* Bitcoin dominance is reducing gradually in cryptocurrency market after enjoying more than 80% dominance till 2017. In May 2017, Bitcoin market cap fell below 50% for first time.
* Bitcoin Cash is newer than Litecoin but has more Market Cap.
* Bitcoin Cash market cap has also caught up with Ripple market cap even though the later is an old and stable currency.
* Ethereum witnessed maximum increase in market cap in 2017 followed by Ripple and Litecoin.
**Analysis using closing price of top 5 cryptocurrencies**
* Cryptocurrecnies show most variation in closing prices in 2017.
* Bitcoin Cash closing price rallied in August 2017 post it's release. But, it's closing price fell below the price on release date in September 2017. Rest of the currencies show overall upward trend in closing prices compared to beginning of 2017.
* Bitcoin Cash showed maximum standard devaition in daily closing price change.
* Ripple has least standard devaition in daily closing price change.
**Analysis using closing price of all cryptocurrencies**
* Numeraire and Bitcoin cash have overall decreasing trend in closing price.
* Omisego, Monero, Ethereum Classic, Bitcoin and Litecoin show overall increasing trend in closing price with Omisego be
The aim of this analysis is to see some trends and visualizations for closing price and market cap among 17 cryptocurrencies. There are more than 1000 cryptocurrencies listed online and hence, this analysis is not comprehensive. Also, this analysis is not predictive and doesn't answer the question "which is the best cryptocurrency to invest"!! Comprehensive analysis is required with additional data to predict the prices and identify best cryptocurrency to invest.
Input Data {data-navmenu="About" data-orientation=rows}
===============================================================================
```{r}
rm(list = ls())
# url containing the input data
url <- c("https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/bitcoin_cash_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/bitcoin_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/bitconnect_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/dash_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/ethereum_classic_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/ethereum_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/iota_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/litecoin_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/monero_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/nem_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/neo_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/numeraire_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/omisego_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/qtum_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/ripple_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/stratis_price.csv",
"https://raw.githubusercontent.com/sarita3011/Cryptocurrency_Historical_Price_Analysis/master/waves_price.csv"
)
# assign input dataframe names using the url name
input_names <- NULL
for (i in 1:17)
{
input_names[i] <- substr(url[i], regexpr("/master",url[i])[1] + 8, nchar(url[i]) - 4)
}
# read files into 17 separate dataframes for each cryptocurrency
for (i in 1:17)
{
assign(input_names[i],fread(url[i]))
}
# generate a combined data frame containing all cryptocurrencies price data
combined_crypto_input <- NULL
for (i in input_names)
{
combined_crypto_input <- i %>%
substr(1,regexpr("_price",i)[1] - 1) %>%
str_replace("_"," ") %>%
upFirst() %>%
cbind(get(i)) %>%
rbind(combined_crypto_input)
}
names(combined_crypto_input)[1] <- "Crypto_Type"
combined_crypto_input <- as_tibble(combined_crypto_input)
```
Row {data-height=700}
---------------------------------------------------------
### **Import Historical Price Data**
The cryptocurrency historical prices data are downloaded from [Kaggle](https://www.kaggle.com/sudalairajkumar/cryptocurrencypricehistory).
There are 17 datasets each for a cryptocurrency that contains historical price information from different starting dates till October 3, 2017. Summary of these datasets is displayed in the sidebar.
\newline
For analysis, the data for all cryptocurrencies is combined into a single dataframe. There are total **`r nrow(combined_crypto_input)`** observations and **`r ncol(combined_crypto_input)`** variables for historical price of cryptocurrencies.
\newline
The variables included are described as below:
```{r}
# data types summary
description <- c("Date of observation",
"Opening price on the given day",
"Highest price on the given day",
"Lowest price on the given day",
"Closing price on the given day",
"Volume of transactions on the given day",
"Market capitalization in USD")
bitcoin_price %>%
sapply(class) %>%
cbind(description) %>%
datatable(colnames = c("Variable Name", "Data Type", "Description"))
```
\newline
\newline
### **Summary of Cryptocurrencies Historical Price Data**
```{r}
# summary of cryptocurrencies
combined_crypto_input %>%
group_by(Crypto_Type) %>%
summarise("Price History Start Date" = min(mdy(Date)),
"Price History End Date" = max(mdy(Date)), Count = n()) %>%
arrange(desc(Count)) %>%
datatable(colnames = c("Cryptocurrency", "Price History Start Date", "Price History End Date", "# of Observations"))
```
Row {data-height=450}
-------------------------------------
### **Input Data Preview**
```{r}
# raw data preview
combined_crypto_input %>%
arrange(Crypto_Type) %>%
head(n = 10) %>%
kable(colnames = c("Cryptocurrency", "Date", "Open", "High", "Low", "Close", "Volume", "MarketCap"))
```
Data Cleaning {data-navmenu="About" data-orientation=rows}
===============================================================================
Column {.sidebar data-width=700}
-------------------------------------------------------------------------------
### Data Cleaning
***Data type Conversion***
Data type is converted for below columns as per following:
|Variable Name | Existing Data Type | New Data Type | Procedure to Convert |
|-------------:|-------------------:|--------------:| -------------------------------------:|
|Date | Character | Date | Use `mdy` function from `lubridate` package to convert Character date to standard R date|
|Volume | Character | 64 bit integer | The values for this column don't fit base R integer range. Hence, these are converted to `integer64` type using `bit64` package. Before conversion, the "," between numbers needs to be removed.|
|Market Cap | Character | 64 bit integer | The values for this column also don't fit base R integer range. Hence, these are converted to `integer64` type using `bit64` package. Before conversion, the "," between numbers needs to be removed.|
```{r}
# convert date from Char to standard R date format
combined_crypto_input$Date <- mdy(combined_crypto_input$Date)
# Volume and market Cap are defined as char. Convert these to numeric
# Volume values are more than R integer max value. So Volume column will be converted to
# integer 64 using bit64 package functions
combined_crypto_input$Volume <- as.integer64(gsub(",","",combined_crypto_input$Volume))
combined_crypto_input$`Market Cap` <- as.integer64(gsub(",","",combined_crypto_input$`Market Cap`))
```
***Missing Values Verification***
Below is summary of missing values removed from the input data:
```{r}
# Market cap variable name has space, rename for ease of usage
names(combined_crypto_input)[8] <- "MarketCap"
```
* `r sum(is.na(combined_crypto_input$Volume))` missing values for Volume variable
* `r sum(is.na(combined_crypto_input$MarketCap))` missing values for Market Cap variable
The list of currencies and start/end date of missing values observations removed are as follows:
```{r}
# summary of missing data
combined_crypto_input %>%
filter(is.na(Volume) | is.na(MarketCap)) %>%
group_by(Crypto_Type) %>%
summarise(Count = n(), `Start Date` = min(Date), `End Date` = max(Date)) %>%
arrange(desc(Count)) %>%
kable(col.names = c("Cryptocurrency", " # of Missing Observations", "Start Date", "End Date"))
```
These observations are missing due to measurement issue in the input data. So, these are removed for our analysis.
```{r}
# remove missing observations and add new columns so that int64 data can be used in plots
combined_crypto_input_clean <- na.omit(combined_crypto_input)
names(combined_crypto_input_clean)[8] <- "MarketCap"
combined_crypto_input_clean <- combined_crypto_input_clean %>%
mutate(MarketCapK = MarketCap / 1000 ,
MarketCapM = MarketCap / 1000000000,
VolumeK = Volume / 1000)
```
Row {data-height=600}
-------------------------------------------------------------------------------
### ***Data Preview After Cleaning***
```{r}
# cleaned data
combined_crypto_input_clean %>%
arrange(desc(Volume)) %>%
select(Crypto_Type, Date, Open, High, Low, Close, VolumeK, MarketCapK) %>%
head(n = 20) %>%
datatable(colnames = c("Cryptocurrency", "Date", "Open", "High", "Low", "Close", "Volume (in 1000s)", "MarketCap (in 1000 $)")) %>%
formatCurrency(columns = c("Open","High", "Low", "Close", "MarketCapK"), digits = 0) %>%
formatCurrency(columns = c("VolumeK"),currency = "", interval = 3, mark = ",", digits = 0)
```
Row
-------------------------------------------------------------------------------
### ***Data Summary After Cleaning***
There are total **`r nrow(combined_crypto_input_clean)`** observations for historical price of cryptocurrencies. Below is summary of data by each cryptocurrency:
```{r}
# summarize cryptocurrency after cleaning
combined_crypto_input_clean %>%
group_by(Crypto_Type) %>%
summarise("Price History Start Date" = min(Date),
"Price History End Date" = max(Date), Count = n()) %>%
arrange(desc(Count)) %>%
kable(col.name = c("Cryptocurrency", "Price History Start Date", "Price History End Date", "# of Observations"))
```
Percentage Change {data-navmenu="Explore" data-orientation=rows}
===============================================================================
This analysis is done for cryptocurrencies that have 52 weeks of historical price data available. Hence, the cryptocurrencies launched in 2017 are excluded.
Row {data-height=700}
-------------------------------------------------------------------------------
### **Summary of %age Increase in Closing Price (Weekly, Monthly and Quarterly Change)**
```{r}
# create function to find %age change in price based on cryptocurrency name and period
close_change_fn <- function(currency, n)(
(combined_crypto_input %>%
filter(Crypto_Type == currency) %>%
filter(Date == max(Date)) %>%
select(Close) -
combined_crypto_input %>%
filter(Crypto_Type == currency) %>%
filter(Date == max(Date) - n) %>%
select(Close)) / combined_crypto_input %>%
filter(Crypto_Type == currency) %>%
filter(Date == max(Date) - n) %>%
select(Close)
)
close_change <- NULL
curr_with_52_week_data <- c("Bitcoin", "Litecoin", "Ripple", "Dash", "Monero", "Nem",
"Ethereum", "Waves", "Ethereum Classic", "Stratis")
# find weely, monthly, quartely and annualy change
for (i in curr_with_52_week_data)
{
change1 <- close_change_fn(i, 7)
change2 <- close_change_fn(i, 30)
change3 <- close_change_fn(i, 91)
change4 <- close_change_fn(i, 365)
curr_change <- NULL
curr_change <- data.frame(i,change1, change2, change3, change4)
close_change <- rbind(close_change, curr_change)
}
names(close_change) <- c("Crypto_Type", "Weekly_Change", "Monthly_Change",
"Quaterly_Change", "Annually_Change")
# plot barcharts to compare %age change across cryptocurrencies
close_change %>% plot_ly(x = ~Crypto_Type, y = ~Weekly_Change, type = "bar", name = "Weekly Change") %>%
add_trace(y = ~Monthly_Change, name = "Monthly Change") %>%
add_trace(y = ~Quaterly_Change, name = "Quarterly Change") %>%
layout(xaxis = list(title = 'Cryptocurrency'),
yaxis = list(title = 'Change', tickformat = "%"),
title = 'Change in Cryptocurrency Closing Price from October 2017')
```
### **Summary of %age Increase in Closing Price (Annually Change)**
```{r}
# plot annual change separately as %age increase is much more than change in any other duration
close_change %>% plot_ly(x = ~Crypto_Type, y = ~Annually_Change, type = "bar", name = "Annually Change") %>%
layout(xaxis = list(title = 'Cryptocurrency'),
yaxis = list(title = 'Change', tickformat = "%"),
title = 'Change in Cryptocurrency Closing Price from October 2017')
```
Row {data-height=300}
-------------------------------------------------------------------------------
### **Observations Based on Weekly, Monthly and Quarterly Change**
* All cryptocurrencies saw decrease in closing price in October. Negative values for monthly change bar represent this information.
* Maximum quaterly increase in closing price is visible for Monero followed by Bitcoin and Dash.
* Stratis fell most in term of quaterly price followed by Ethereum Classic and Ripple.
* Stratis overall has downward trend in terms of all %age change.
* Monero has grown more than 100% in a quarter.
### **Observations Based on Annually Change**
* All cryptocurrencies soared in 2017.
* Maximum increase in closing price is observed for Stratis. It was launched in 2016 with very small price in comparison to 2017 price.
* Only Bitcoin and Ethereum Classic saw less than 1000% growth.
Market Cap Exploration {data-navmenu="Explore" data-orientation=rows}
===============================================================================
Column {data-width=650}
-------------------------------------------------------------------------------
###
```{r}
# plot for market cap of top 5 cryptocurrencies
x <- combined_crypto_input_clean %>%
filter(Crypto_Type %in% c("Bitcoin", "Ethereum", "Bitcoin Cash", "Ripple",
"Litecoin")) %>%
plot_ly(x = ~Date, y = ~MarketCapM, color = ~Crypto_Type, type = 'scatter',
mode = 'lines+markers') %>%
layout(title = "Market Cap of Top 5 Cryptocurrencies",
xaxis = list(title = ""),
yaxis = list(title = "Market Cap (in billion $)", tickformat = "$"),
autosize = T
)
x
```
***
Column {data-width=350}
-------------------------------------------------------------------------------
### **Observations**
* Maximum increase in market cap is witnessed in 2017.
* Bitcoin Cash is newer than Litecoin but has more Market Cap.
* Bitcoin Cash market cap has also caught up with Ripple market cap even though the later is an old and stable currency.
* Ripple overtook Ethereum in terms of market cap from May 15 2017 - May 2017.
* May 18, 2017 has highest recorded market cap for Ripple. This was due to speculations related to usage of Ripple's payment network by large banks and enterprises.
* Bitcoin recorded highest market cap on Sep 1, 2017 followed by a steep decrease due to massive sell-offs.
* Ethereum Market cap soared in June 2017 which is in conjuction with corporate's interest in using the technology for smart contract applications.
### **Percentage Change in Market Cap of Top 5 Cryptocurrencies**
Ethereum witnessed maximum increase in market cap in 2017
```{r}
# find Percentage Change in Market Cap of Top 5 Cryptocurrencies
a <- combined_crypto_input_clean %>%
filter(Crypto_Type == "Bitcoin Cash" & Date == ymd('2017-10-03')) %>%
select(MarketCap)
b <- combined_crypto_input_clean %>%
filter(Crypto_Type == "Bitcoin Cash" & Date == ymd('2017-08-02')) %>%
select(MarketCap)
bc_increase <- data.frame("Bitcoin Cash", (a - b) * 100 / b, stringsAsFactors = FALSE)
names(bc_increase) <- c('Crypto_Type', "% increase in market cap in 2017")
combined_crypto_input_clean %>%
filter((Crypto_Type %in% c("Bitcoin", "Ethereum", "Litecoin", "Ripple")) &
(Date %in% c(ymd('2017-01-01'), ymd('2017-10-03')))) %>%
select(Crypto_Type, Date, MarketCap) %>%
spread(Date, MarketCap) %>%
mutate("% increase in market cap in 2017" = (`2017-10-03` - `2017-01-01`) * 100 / `2017-01-01`) %>%
select(Crypto_Type, `% increase in market cap in 2017`) %>%
rbind(bc_increase) %>%
arrange(desc(`% increase in market cap in 2017`)) %>%
kable(col.names = c("Cryptocurrency", "% Increase in Market Cap in 2017"), digits = 0)
```
***
Closing Price View {data-navmenu="Explore"}
===============================================================================
Row {data-width=900}
-------------------------------------------------------------------------------
###
```{r}
# plot closing price of top 5 cryptocurrencies
combined_crypto_input_clean %>%
filter(Crypto_Type %in% c("Bitcoin", "Ethereum", "Bitcoin Cash", "Ripple",
"Litecoin")) %>%
plot_ly(x = ~Date, y = ~Close, color = ~Crypto_Type, type = 'scatter',
mode = 'lines+markers') %>%
layout(title = "Closing Price of Top 5 Cryptocurrencies",
xaxis = list(title = ""),
yaxis = list(title = "Closing Price", tickformat = "$"))
sd_curr <- NULL
top_5_currency_name <- c("Bitcoin", "Ethereum", "Bitcoin Cash", "Ripple",
"Litecoin")
# starting date of data for 5 currencies to be passed for creating time series object
y <- c(2014, 2015, 2017, 2014, 2014)
m <- c(01, 08, 08, 01, 01)
d <- c(01, 08, 02, 01, 01)
# function to create time series object and use diff function
close_price_diff_sd_function <- function(currency, yr, mo, dt)
(
sd(combined_crypto_input_clean %>%
filter(Crypto_Type == currency & Date > ymd('2014-01-01')) %>%
arrange(Date) %>%
select(Close) %>%
ts(start = c(yr, mo, dt), frequency = 365) %>%
diff())
)
# call function to find standard deviation in change in daily close price
for (i in 1:length(top_5_currency_name))
{
s <- close_price_diff_sd_function(currency = top_5_currency_name[i],
yr <- y[i], mo <- m[i], dt <- d[i])
df <- data.frame(top_5_currency_name[i], s)
sd_curr <- rbind(sd_curr, df)
}
```
### **Observations**
Based on closing price:
* Ripple shows least variation in closing price while bitcoin shows most variations
* Cryptocurrecnies shows most variation in closing prices in 2017
* Bitcoin Cash closing price rallied in August 2017 post it's release. But, it's closing price fell below the price on release date in September 2017.
* Rest of the currencies show overall upward trend in closing prices compared to beginning of 2017.
Based on first difference transformation of closing price:
* Below is standard deviation of differenced time series
```{r}
sd_curr %>%
arrange(desc(s)) %>%
kable(col.names = c("Cryptocurrency", "Standard Deviation of Change in Daily Closing Price"), digits = 2)
```
* Bitcoin Cash showed maximum standard devaition in daily closing price change. This is in line to trend analysis where we see steep rise and fall in prices. Also, the differenced time series graph shows many fluctuations.
* Ripple has least standard devaition in daily closing price change.
Row
-------------------------------------------------------------------------------
### **First Difference Transformation of Closing Price for Top 5 Cryptocurrencies**
The difference series is examined to identify the increments. It is obtained from differences in successive observations between each day. Below are the plots for first difference transformations of closing price of top 5 cryptocurrencies:
```{r}
# plot differenced time series
close_price_diff_plot_function <- function(currency, yr, mo, dt)
(
combined_crypto_input_clean %>%
filter(Crypto_Type == currency & Date > ymd('2014-01-01')) %>%
arrange(Date) %>%
select(Close) %>%
ts(start = c(yr, mo, dt), frequency = 365) %>%
diff() %>%
plot.ts(main = currency, xlab = "Day", ylab = "Difference in Closing Price(in $)")
)
for (i in 1:length(top_5_currency_name))
{
close_price_diff_plot_function(currency = top_5_currency_name[i],
yr <- y[i], mo <- m[i], dt <- d[i])
}
```
Bitcoin Dominance Diminishing? {data-navmenu="Explore" data-orientation=rows }
===============================================================================
Row {data-height=750}
-------------------------------------------------------------------------------
###
```{r}
# plot for Top 5 Cryptocurrency Market Cap versus Total Cryptocurrency Market Cap
combined_crypto_input_clean %>%
select(Crypto_Type, Date, MarketCapK) %>%
spread(Crypto_Type, MarketCapK, fill = 0) %>%
mutate(all_market_capK = rowSums(.[2:18])) %>%
mutate(Ethereum = (Ethereum / all_market_capK),
Bitcoin = (Bitcoin / all_market_capK),
"Bitcoin Cash" = (`Bitcoin Cash` / all_market_capK),
Litecoin = (Litecoin / all_market_capK),
Ripple = (Ripple / all_market_capK)) %>%
select(Date, Ethereum, Bitcoin, `Bitcoin Cash`, Litecoin,
Ripple) %>%
gather(crypto, percent, -Date) %>%
plot_ly(x = ~Date, y = ~percent, color = ~crypto, type = 'scatter',
mode = 'lines') %>%
add_trace(y = 0.5, name = "50% Market Cap", mode = "lines", color = NULL) %>%
layout(title = "Top 5 Cryptocurrency Market Cap versus Total Cryptocurrency Market Cap",
xaxis = list(title = ""),
yaxis = list(title = "% Market Cap", tickformat = "%"))
```
***
Row {data-height=250}
--------------------------------------------------------------------------------
### **Observations**
* Bitcoin dominance is reducing gradually in cryptocurrency market after enjoying more than 80% dominance till 2017.
* In May 2017, Bitcoin market cap fell below 50% for first time.
* In June 2017, Ethereum market cap soared bringing Bitcoin market cap below 50%.
* In May 2017, Ripple market cap soared bringing Bitcoin market cap down.
Trend Analysis {data-navmenu="Explore" data-orientation=rows}
===============================================================================
Based on closing price trend analysis, below are the observations
Row {data-height=350}
------------------------------------------------------------------------------
###
**Sharp Decreasing Trend in Closing Price**
* Numeraire
* Bitcoin Cash
Both of these cryptocurrecies are new in the market launched in 2017.
**Sharp Increasing Trend in Closing Price**
* Omisego
* Monero
* Ethereum Classic
* Bitcoin
* Litecoin
Only Omisego among aboe is new in market launched in 2017.
###
**Overall Increasing Trend with Intermediate Fluctuations Closing Price**
* Waves
* Stratis
* Ripple
* Nem
* Ethereum
* Neo
**Overall Same Closing Price with Volatile Intermediate Fluctuations**
* Qtum
* Iota
Both of these cryptocurrecies are new in the market launched in 2017.
\newline
\newline
\newline
Row {data-height=650}
------------------------------------------------------------------------------
### **Trend Plots Based on 15 day Simple Moving Average of Closing Price of All Cryptocurrencies**
```{r}
# create time series,find simple moving average and plot trend for all currencies
trend_plot_function <- function(currency, yr, mo, dt, n = 5) {
combined_crypto_input_clean %>%
filter(Crypto_Type == currency & Date >= ymd('2014-01-01')) %>%
arrange(Date) %>%
select(Close) %>%
ts(start = c(yr, mo, dt), frequency = 365) %>%
SMA(n = 15) %>%
plot.ts(main = currency, xlab = "Day", ylab = "Closing Price (in $)")
}
all_curr_name <- unique(combined_crypto_input_clean$Crypto_Type)
# start dates to be supplied to time series objects
y <- c(2016, 2016, 2014, 2017, 2017, 2017, 2016, 2015, 2014, 2014, 2017, 2015,
2016, 2014, 2017, 2014, 2017)
m <- c(06, 08, 01, 07, 07, 06, 10, 04, 05, 01, 06, 08, 07, 02, 01, 01, 08)
d <- c(21, 13, 01, 13, 16, 24, 26, 01, 21, 01, 13, 08, 25, 14, 20, 01, 02)
for (i in 1:length(all_curr_name))
{
trend_plot_function(currency = all_curr_name[i], yr <- y[i], mo <- m[i], dt <- d[i])
}
```