Project on Cryptocurrency

Project on Cryptocurrency

1. Introduction

A cryptocurrency (or crypto currency) is a digital asset designed to work as a medium of exchange that uses cryptography to secure its 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. Cryptocurrencies use decentralized control as opposed to centralized electronic money and central banking systems. The decentralized control of each cryptocurrency works through a blockchain, which is a public transaction database, functioning as a distributed ledger.

2.Over view of Study

The dataset is a combination of all the different types of currencies. Here we have mentioned all the currencies value according values of bits coin and also mentioned their values according to USd. We also mentioned the growth of each currencies in 1hr ,24hrs and in 7days. these will help to measure the continuous ups and downs of their value.

3. An empirical field study of Cryptocurrency in all over the world.

Decentralized cryptocurrency is produced by the entire cryptocurrency system collectively, at a rate which is defined when the system is created and which is publicly known. In centralized banking and economic systems such as the Federal Reserve System, corporate boards or governments control the supply of currency by printing units of fiat money or demanding additions to digital banking ledgers. In case of decentralized cryptocurrency, companies or governments cannot produce new units, and have not so far provided backing for other firms, banks or corporate entities which hold asset value measured in it. The underlying technical system upon which decentralized cryptocurrencies are based was created by the group or individual known as Satoshi Nakamoto.

As of September 2017, over a thousand cryptocurrency specifications exist; most are similar to and derive from the first fully implemented decentralized cryptocurrency, bitcoin. Within cryptocurrency systems the safety, integrity and balance of ledgers is maintained by a community of mutually distrustful parties referred to as miners: members of the general public using their computers to help validate and timestamp transactions, adding them to the ledger in accordance with a particular timestamping scheme.Miners have a financial incentive to maintain the security of a cryptocurrency ledger.

Most cryptocurrencies are designed to gradually decrease production of currency, placing an ultimate cap on the total amount of currency that will ever be in circulation, mimicking precious metals. Compared with ordinary currencies held by financial institutions or kept as cash on hand, cryptocurrencies can be more difficult for seizure by law enforcement. This difficulty is derived from leveraging cryptographic technologies.

a.Overview

This project will deal with variation of the values of each currencies . If we prove that we can accept the hypothesis we can predict the variation and can predict the ups and downs .

b.Hypothesis

\[ Variation=\alpha 0+\alpha1percent_change_1h+\alpha2percent_change_24h+\alpha3percent_change_7days+e \]

d. Data:

crypto.df <- read.csv(paste("cryptocurrencies_prices.csv", sep=""), stringsAsFactors=FALSE)
head(crypto.df)
##   X           id         name symbol rank   price_usd  price_btc
## 1 1      bitcoin      Bitcoin    BTC    1 1.34813e+04 1.00000000
## 2 2       ripple       Ripple    XRP    2 2.29933e+00 0.00017157
## 3 3     ethereum     Ethereum    ETH    3 8.81320e+02 0.06576140
## 4 4 bitcoin-cash Bitcoin Cash    BCH    4 2.44816e+03 0.18267400
## 5 5      cardano      Cardano    ADA    5 7.05031e-01 0.00005261
## 6 6     litecoin     Litecoin    LTC    6 2.45097e+02 0.01828840
##   X24h_volume_usd market_cap_usd available_supply total_supply max_supply
## 1     14254300000   226178291103         16777187     16777187    2.1e+07
## 2      2126830000    89074077921      38739144847  99993093880    1.0e+11
## 3      4720680000    85240084528         96718654     96718654         NA
## 4      1086780000    41346668220         16888875     16888875    2.1e+07
## 5       158158000    18279388468      25927070538  31112483745    4.5e+10
## 6       846307000    13376814153         54577633     54577633    8.4e+07
##   percent_change_1h percent_change_24h percent_change_7d last_updated
## 1              0.88              -3.32            -10.65   1514877260
## 2              1.85               2.03            104.76   1514877241
## 3              0.88              14.21             13.91   1514877249
## 4              0.13              -2.59            -18.72   1514877253
## 5              0.69              -0.43             68.51   1514877255
## 6              1.75               5.04            -12.85   1514877241
subcrypto<-crypto.df[6:15]
subcrypto1<-subcrypto[c(-3,-4,-6)]

subcryp <- crypto.df[crypto.df$available_supply !=0 ,]
 subcryp1 <- subcryp[subcryp$X24h_volume_usd !=0 ,]
  subcryp1<- subcryp1[order(subcryp1$rank),]

f.Result:

This paper was motivated by the need for research that could improve our understanding of Cryptocurrency influences the price increase strategies in the world . The unique contribution of this paper is that we investigated the price premium charged. We observed currencies charging price based on these parameters.

#Conclusion:

Our observation gave an overall view of our prediction and dependecies by which we can predict why currencies are differed every time . this result gave us a basic overview of what is crypto currency why it differs . which parameters are the main reason for this change.

Reference:

https://en.wikipedia.org/wiki/Cryptocurrency
https://blockgeeks.com/guides/what-is-cryptocurrency
https://stackoverflow.com/questions/tagged/r
https://www.r-project.org/mail.html
http://www.independent.co.uk/life-style/gadgets-and-tech/news/bitcoin-price-live-updates-latest-value-exchange-rate-digital-cryptocurrency-futures-investment-a8184781.html

Summary Statistics from the cryptocurrency data

->Descriptive statistics (min, max, median etc) of each variable

library(psych)
describe(crypto.df)
## Warning in describe(crypto.df): NAs introduced by coercion

## Warning in describe(crypto.df): NAs introduced by coercion

## Warning in describe(crypto.df): NAs introduced by coercion
## Warning in FUN(newX[, i], ...): no non-missing arguments to min; returning
## Inf
## Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning
## -Inf
##                    vars    n         mean           sd       median
## X                     1 1381 6.910000e+02 3.988000e+02 6.910000e+02
## id*                   2 1381          NaN           NA           NA
## name*                 3 1381 1.337000e+03           NA 1.337000e+03
## symbol*               4 1381          Inf          NaN 8.080000e+02
## rank                  5 1381 6.910000e+02 3.988000e+02 6.910000e+02
## price_usd             6 1379 1.026730e+03 2.596996e+04 1.200000e-01
## price_btc             7 1379 8.000000e-02 1.940000e+00 0.000000e+00
## X24h_volume_usd       8 1329 2.833863e+07 4.327306e+08 2.159430e+04
## market_cap_usd        9 1079 5.812979e+08 7.991407e+09 4.326552e+06
## available_supply     10 1079 8.663087e+09 1.212343e+11 2.302034e+07
## total_supply         11 1262 7.481779e+11 2.596479e+13 4.501933e+07
## max_supply           12  246 4.102795e+12 6.375730e+13 1.010000e+08
## percent_change_1h    13 1333 1.440000e+00 1.107000e+01 1.210000e+00
## percent_change_24h   14 1338 1.053000e+01 4.885000e+01 2.000000e+00
## percent_change_7d    15 1325 4.814000e+01 1.478300e+02 1.324000e+01
## last_updated         16 1379 1.514872e+09 6.330238e+04 1.514877e+09
##                         trimmed          mad           min          max
## X                  6.910000e+02       511.50          1.00 1.381000e+03
## id*                         NaN           NA           Inf         -Inf
## name*              1.337000e+03         0.00       1337.00 1.337000e+03
## symbol*                     Inf       753.16         42.00          Inf
## rank               6.910000e+02       511.50          1.00 1.381000e+03
## price_usd          6.800000e-01         0.18          0.00 8.749520e+05
## price_btc          0.000000e+00         0.00          0.00 6.529000e+01
## X24h_volume_usd    5.563710e+05     31981.80          0.32 1.425430e+10
## market_cap_usd     2.209816e+07   6334448.53         13.00 2.261783e+11
## available_supply   9.098716e+07  32492283.54          0.00 3.386511e+12
## total_supply       2.020766e+08  64370211.73          1.00 9.223429e+14
## max_supply         6.436173e+08 142329600.00        300.00 1.000000e+15
## percent_change_1h  1.110000e+00         1.57        -77.05 2.367500e+02
## percent_change_24h 4.630000e+00        12.59        -81.09 9.377000e+02
## percent_change_7d  2.410000e+01        36.00        -85.50 3.252430e+03
## last_updated       1.514877e+09         7.41 1513173873.00 1.514877e+09
##                           range   skew kurtosis           se
## X                  1.380000e+03   0.00    -1.20 1.073000e+01
## id*                        -Inf     NA       NA           NA
## name*              0.000000e+00     NA       NA           NA
## symbol*                     Inf    NaN      NaN          NaN
## rank               1.380000e+03   0.00    -1.20 1.073000e+01
## price_usd          8.749520e+05  30.31   968.17 6.993400e+02
## price_btc          6.529000e+01  30.31   968.17 5.000000e-02
## X24h_volume_usd    1.425430e+10  28.22   889.71 1.187012e+07
## market_cap_usd     2.261783e+11  23.35   611.87 2.432834e+08
## available_supply   3.386511e+12  23.18   597.20 3.690750e+09
## total_supply       9.223429e+14  35.43  1254.65 7.308952e+11
## max_supply         1.000000e+15  15.49   238.99 4.065017e+12
## percent_change_1h  3.138000e+02  10.41   205.85 3.000000e-01
## percent_change_24h 1.018790e+03   9.70   141.08 1.340000e+00
## percent_change_7d  3.337930e+03  10.43   182.67 4.060000e+00
## last_updated       1.703391e+06 -20.93   496.56 1.704660e+03

Boxplot of the variables .

#currency in usd
boxplot(log(crypto.df$price_usd) , col ="red" , main= "Currencies comapison using USD as a parameter ")

boxplot(log(crypto.df$price_btc),col = "blue" , main= "Currencies comapison using Bit coins as a parameter ")

Histograms

hist(crypto.df$percent_change_1h ,main = "percentage change in 1hr" ,col = c(12,38))

hist(crypto.df$percent_change_24h , main = "percentage change in 24hr" ,col = c(15,8))

hist(crypto.df$percent_change_7d, main = "percentage change in 7days", col=c(19,22))

After seeing this histogram a huge difference occurred between 1hr ,24hr and 7days

Suitable plot

plot(log(crypto.df$market_cap_usd), main = "market capacity")

Market Capacity

library(treemap)

market_today <- read.csv('cryptocurrencies_prices.csv',header = T, stringsAsFactors = F)

df1 <- na.omit(market_today[,c('id','market_cap_usd')])

df1$market_cap_usd <- as.numeric(df1$market_cap_usd)

df1$formatted_market_cap <-  paste0(df1$id,'\n','$',format(df1$market_cap_usd,big.mark = ',',scientific = F, trim = T))

treemap(df1, index = 'formatted_market_cap', vSize = 'market_cap_usd', title = 'Cryptocurrency Market Cap', fontsize.labels=c(12, 8), palette='RdYlGn')

Correlation matrix:

library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
## 
##     describe
## The following objects are masked from 'package:base':
## 
##     format.pval, units
rcorr(as.matrix(subcrypto1))
##                    price_usd price_btc available_supply max_supply
## price_usd               1.00      1.00             0.00      -0.01
## price_btc               1.00      1.00             0.00      -0.01
## available_supply        0.00      0.00             1.00       0.00
## max_supply             -0.01     -0.01             0.00       1.00
## percent_change_1h       0.00      0.00            -0.03      -0.04
## percent_change_24h      0.00      0.00             0.05      -0.02
## percent_change_7d      -0.01     -0.01             0.19      -0.01
##                    percent_change_1h percent_change_24h percent_change_7d
## price_usd                       0.00               0.00             -0.01
## price_btc                       0.00               0.00             -0.01
## available_supply               -0.03               0.05              0.19
## max_supply                     -0.04              -0.02             -0.01
## percent_change_1h               1.00               0.27              0.10
## percent_change_24h              0.27               1.00              0.29
## percent_change_7d               0.10               0.29              1.00
## 
## n
##                    price_usd price_btc available_supply max_supply
## price_usd               1379      1379             1079        246
## price_btc               1379      1379             1079        246
## available_supply        1079      1079             1079        218
## max_supply               246       246              218        246
## percent_change_1h       1333      1333             1058        245
## percent_change_24h      1338      1338             1056        245
## percent_change_7d       1325      1325             1058        239
##                    percent_change_1h percent_change_24h percent_change_7d
## price_usd                       1333               1338              1325
## price_btc                       1333               1338              1325
## available_supply                1058               1056              1058
## max_supply                       245                245               239
## percent_change_1h               1333               1304              1291
## percent_change_24h              1304               1338              1302
## percent_change_7d               1291               1302              1325
## 
## P
##                    price_usd price_btc available_supply max_supply
## price_usd                    0.0000    0.9176           0.9066    
## price_btc          0.0000              0.9176           0.9065    
## available_supply   0.9176    0.9176                     0.9973    
## max_supply         0.9066    0.9065    0.9973                     
## percent_change_1h  0.9778    0.9778    0.3539           0.4912    
## percent_change_24h 0.9080    0.9079    0.1258           0.7444    
## percent_change_7d  0.6531    0.6532    0.0000           0.8555    
##                    percent_change_1h percent_change_24h percent_change_7d
## price_usd          0.9778            0.9080             0.6531           
## price_btc          0.9778            0.9079             0.6532           
## available_supply   0.3539            0.1258             0.0000           
## max_supply         0.4912            0.7444             0.8555           
## percent_change_1h                    0.0000             0.0004           
## percent_change_24h 0.0000                               0.0000           
## percent_change_7d  0.0004            0.0000

Correlation matrix using corrgram

library(coefplot)
library(corrgram)
corrgram(subcrypto1,lower.panel=panel.pts, upper.panel=panel.pie,
diag.panel=panel.minmax, text.panel=panel.txt)

Scatterplot Matrix:

library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
scatterplotMatrix(~subcrypto1$percent_change_1h+subcrypto1$percent_change_24h+subcrypto1$percent_change_7d , col = c(5,15,8,39,35) )

Model

mod1<- percent_change_1h~percent_change_24h+percent_change_7d
fit1<-lm(mod1, data = crypto.df)
summary(fit1)
## 
## Call:
## lm(formula = mod1, data = crypto.df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -72.481  -1.344   0.435   1.481 200.005 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        0.549830   0.294287   1.868   0.0619 .  
## percent_change_24h 0.060012   0.005890  10.188   <2e-16 ***
## percent_change_7d  0.003431   0.002361   1.453   0.1464    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.724 on 1270 degrees of freedom
##   (108 observations deleted due to missingness)
## Multiple R-squared:  0.0892, Adjusted R-squared:  0.08776 
## F-statistic: 62.19 on 2 and 1270 DF,  p-value: < 2.2e-16

We can see that the p value is <.05 so we can say that our hypothesis is accepted and we can predict the value using the markets condition.

attach(crypto.df)
t.test(percent_change_1h,percent_change_24h)
## 
##  Welch Two Sample t-test
## 
## data:  percent_change_1h and percent_change_24h
## t = -6.6379, df = 1474.4, p-value = 4.458e-11
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -11.776400  -6.403925
## sample estimates:
## mean of x mean of y 
##  1.440503 10.530665
t.test(percent_change_1h,percent_change_7d)
## 
##  Welch Two Sample t-test
## 
## data:  percent_change_1h and percent_change_7d
## t = -11.466, df = 1338.8, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -54.68409 -38.70564
## sample estimates:
## mean of x mean of y 
##  1.440503 48.135366
t.test(percent_change_24h,percent_change_7d)
## 
##  Welch Two Sample t-test
## 
## data:  percent_change_24h and percent_change_7d
## t = -8.7961, df = 1607.2, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -45.99017 -29.21923
## sample estimates:
## mean of x mean of y 
##  10.53067  48.13537

Applying t-test we can see the above result so we can accept the data as p value <.05 so we can accept the null hypothesis .