MarketCap <- function(top_cc, dload)
{
mark <- gvisColumnChart(top_cc[1:10, ], "name", "market_cap_usd", options = list(title = "Market Cap Of Leading Cryptocurrencies", legend = "left"))
plot(mark)
if (dload) {
coins <- crypto::crypto_list()
data1 <- crypto::crypto_history(coin = c("BTC", "ETH", "XRP", "BCH", "ADA"))
}
#kable(head(coins))
p = gvisAnnotationChart(data1, idvar = "name", "date", "market", options = list(title = "Market Cap Trend", legend = "top"))
plot(p)
coins <- unique(data1$name)
s_date = Sys.Date() - 1
data1$market_growth <- NA
for (i in coins) {
data1[data1$name == i, ]$market_growth = Delt(data1[data1$name == i, ]$market, type = "arithmetic", k = 90)
}
c_data = data1[complete.cases(data1), ] #complete.cases is used to get rwcords without NA
mg_3 = gvisColumnChart(c_data[c_data$date == s_date, ], "name", "market_growth", options = list(title = "Market Growth in the last 3 months", scaleType = "allfixed", legend = "top"))
plot(mg_3)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.