Have a look at the Coin Market Cap website. It is similar to Yahoo Finance.
There is the R package coinmarketcap that provides an API connection.
Unfortunately the API only provides current day data. Their website says Historical Data is Coming Soon.
But to see which Coins are most valuable.
Does this plot seem correct?
library(coinmarketcapr)
plot_top_5_currencies()
library(tidyverse)
market_today <- get_marketcap_ticker_all()
market_today <- as_tibble(market_today)
market_today <- market_today %>% mutate(
rank = as.numeric(rank),
price_usd = as.numeric(price_usd),
price_btc = as.numeric(price_btc),
X24h_volume_usd = as.numeric(X24h_volume_usd),
market_cap_usd = as.numeric(market_cap_usd),
available_supply = as.numeric(available_supply),
total_supply = as.numeric(total_supply),
max_supply = as.numeric(max_supply),
percent_change_1h = as.numeric(percent_change_1h),
percent_change_24h = as.numeric(percent_change_24h),
percent_change_7d = as.numeric(percent_change_7d),
last_updated = as.numeric(last_updated)
)
market_today <- filter(market_today, rank <= 5)
market_today
ggplot(market_today, aes(symbol, price_usd), horizontal = TRUE) + geom_bar(stat="identity")
ggplot(market_today, aes(symbol, price_usd), horizontal = TRUE) + geom_bar(stat="identity") + scale_y_log10() + ylab("log_10(price_usd)")
NA
library(treemap)
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')
His recent video Ethereum Future Price Prediction is all about forecasting Etherium with a LSTM NN.
If you like this visualization, check out finviz.
Sop back to quantmode and using the Yahoo Finance API.
library(quantmod)
Loading required package: xts
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Attaching package: ‘xts’
The following objects are masked from ‘package:dplyr’:
first, last
Loading required package: TTR
Version 0.4-0 included new data defaults. See ?getSymbols.
Learn from a quantmod author: https://www.datacamp.com/courses/importing-and-managing-financial-data-in-r
portfolio = c("BTC-USD","ETH-USD","LTC-USD","XRP-USD","ADA-USD")
getSymbols(portfolio, src="yahoo", from="2017-01-01")
‘getSymbols’ currently uses auto.assign=TRUE by default, but will
use auto.assign=FALSE in 0.5-0. You will still be able to use
‘loadSymbols’ to automatically load data. getOption("getSymbols.env")
and getOption("getSymbols.auto.assign") will still be checked for
alternate defaults.
This message is shown once per session and may be disabled by setting
options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
WARNING: There have been significant changes to Yahoo Finance data.
Please see the Warning section of ‘?getSymbols.yahoo’ for details.
This message is shown once per session and may be disabled by setting
options("getSymbols.yahoo.warning"=FALSE).
[1] "BTC-USD" "ETH-USD" "LTC-USD" "XRP-USD" "ADA-USD"
tail(`BTC-USD`)
BTC-USD.Open BTC-USD.High BTC-USD.Low BTC-USD.Close BTC-USD.Volume BTC-USD.Adjusted
2018-01-13 13841.19 14595.04 13830.28 14243.12 1021352776 14243.12
2018-01-14 14244.12 14415.67 13031.91 13638.63 1112590573 13638.63
2018-01-15 13638.63 14355.82 13416.71 13631.98 1170462750 13631.98
2018-01-16 13634.60 13648.84 10032.69 11282.49 3842651741 11282.49
2018-01-17 11282.49 11736.30 9205.38 11162.70 3666978316 11162.70
2018-01-18 11162.70 12018.43 10642.33 11175.52 2357251805 11175.52
chartSeries(`BTC-USD`)
barChart(`BTC-USD`,theme='white.mono',bar.type='hlc')
chartSeries(`BTC-USD`,TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")
tail(`ETH-USD`)
ETH-USD.Open ETH-USD.High ETH-USD.Low ETH-USD.Close ETH-USD.Volume ETH-USD.Adjusted
2018-01-13 1261.06 1422.86 1261.01 1385.02 744906594 1385.02
2018-01-14 1385.02 1389.32 1267.48 1359.48 610496132 1359.48
2018-01-15 1359.38 1381.35 1271.07 1278.69 537797572 1278.69
2018-01-16 1278.70 1282.27 864.23 1050.26 1931700742 1050.26
2018-01-17 1050.26 1115.66 764.75 1024.69 2034010888 1024.69
2018-01-18 1024.90 1093.90 949.56 1012.97 1117430433 1012.97
chartSeries(`ETH-USD`)
barChart(`ETH-USD`,theme='white.mono',bar.type='hlc')
chartSeries(`ETH-USD`,TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")
tail(`LTC-USD`)
LTC-USD.Open LTC-USD.High LTC-USD.Low LTC-USD.Close LTC-USD.Volume LTC-USD.Adjusted
2018-01-13 235.35 262.87 235.30 257.94 176341211 257.94
2018-01-14 257.94 268.81 231.43 236.86 189083699 236.86
2018-01-15 236.86 244.40 230.79 231.89 110848991 231.89
2018-01-16 231.89 232.40 147.78 183.86 473245937 183.86
2018-01-17 183.70 204.56 136.45 188.21 458374670 188.21
2018-01-18 188.14 208.37 175.46 191.03 274884322 191.03
chartSeries(`LTC-USD`)
barChart(`LTC-USD`,theme='white.mono',bar.type='hlc')
chartSeries(`LTC-USD`,TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")
tail(`XRP-USD`)
XRP-USD.Open XRP-USD.High XRP-USD.Low XRP-USD.Close XRP-USD.Volume XRP-USD.Adjusted
2018-01-13 2.02 2.10 1.9600 2.00 194844832 2.00
2018-01-14 2.00 2.00 1.7600 1.83 185909079 1.83
2018-01-15 1.83 1.88 1.6300 1.66 178452052 1.66
2018-01-16 1.66 1.68 0.8696 1.15 970771226 1.15
2018-01-17 1.15 1.38 0.8747 1.31 929665358 1.31
2018-01-18 1.31 1.73 1.2300 1.57 877858800 1.57
chartSeries(`XRP-USD`)
barChart(`XRP-USD`,theme='white.mono',bar.type='hlc')
chartSeries(`XRP-USD`,TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")
tail(`ADA-USD`)
ADA-USD.Open ADA-USD.High ADA-USD.Low ADA-USD.Close ADA-USD.Volume ADA-USD.Adjusted
2018-01-13 0.8983 0.9590 0.8329 0.8790 6400745 0.8790
2018-01-14 0.8570 0.8576 0.7627 0.7922 36370057 0.7922
2018-01-15 0.8000 0.8666 0.7500 0.7700 3956914 0.7700
2018-01-16 0.7724 0.7952 0.4500 0.6100 14442780 0.6100
2018-01-17 0.6000 0.6839 0.4340 0.6242 15237720 0.6242
2018-01-18 0.6250 0.6996 0.6000 0.6500 2108397 0.6500
chartSeries(`ADA-USD`)
barChart(`ADA-USD`,theme='white.mono',bar.type='hlc')
chartSeries(`ADA-USD`,TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")