E o bitcoin continua surpreendendo, hein? Colocamos abaixo novamente como baixar dados da criptomoeda com o R.
library(Quandl) library(ggplot2) library(forecast) library(scales) btc = Quandl("BCHARTS/ROCKUSD", type='xts') bitcoin = btc$Close bitcoin = apply.monthly(bitcoin, FUN=mean) time = seq(as.Date('2016-01-01'), as.Date('2017-11-01'), by='1 month') data = data.frame(time=time, bitcoin=tail(bitcoin[,2],12+11)) ggplot(data, aes(x=time, y=Close))+ geom_bar(stat='identity', size=.7, colour='darkblue', fill='darkblue')+ geom_text(aes(label=round(Close,0)), size=2.8, hjust=0.5, vjust=-0.5, shape=21, colour="red")+ scale_x_date(breaks = date_breaks("1 months"), labels = date_format("%m/%Y"))+ theme(axis.text.x=element_text(angle=45, hjust=1))+ xlab('')+ylab('')+ labs(title='Bitcoin vs. USD ', subtitle='(Fechamento Diário mensalizado)', caption='Fonte: analisemacro.com.br com dados Quandl R API.')
Onde vai para o bitcoin? 🙂