<iframe src="https://ja.exploratory.io/viz/kanaugust/9213288394094395?embed=true" frameborder="0" width="100%" height="100%" > </iframe>
# Set libPaths.
.libPaths("/Users/kannishida/.exploratory/R/3.4")
# Load required packages.
library(janitor)
library(lubridate)
library(hms)
library(tidyr)
library(stringr)
library(readr)
library(forcats)
library(RcppRoll)
library(dplyr)
library(tibble)
library(exploratory)
# Steps to produce gtrend_bitcoin
`gtrend_bitcoin` <- exploratory::read_delim_file("/Users/kannishida/Dropbox/Data/gtrend-bitcoin.csv" , ",", quote = "\"", skip = 2 , col_names = TRUE , na = c('','NA') , locale=readr::locale(encoding = "UTF-8", decimal_mark = "."), trim_ws = FALSE , progress = FALSE) %>% exploratory::clean_data_frame() %>%
mutate(Month = str_c(Month, "-01"), Month = ymd(Month)) %>%
rename(`GTrend - Bitcoin` = `Bitcoin: (Worldwide)`)
# Steps to produce bitcoin_miners_revenue
`bitcoin_miners_revenue` <- load_quandl('BCHAIN/MIREV', 'wide') %>% readr::type_convert() %>% exploratory::clean_data_frame() %>%
rename(Revenue = Value)
# Steps to produce the output
load_quandl('BCHARTS/BITSTAMPUSD', 'wide') %>% readr::type_convert() %>% exploratory::clean_data_frame() %>%
rename(`Bitcoin Price - USD` = `Weighted Price`) %>%
left_join(bitcoin_miners_revenue, by = c("Date" = "Date")) %>%
mutate(date_month = floor_date(Date, "month")) %>%
left_join(gtrend_bitcoin, by = c("date_month" = "Month")) %>%
mutate(gtrend = `GTrend - Bitcoin`) %>%
filter(Date >= as.Date("2016-01-10") & `Bitcoin Price - USD` > 0)
The data is from Quandl.
Bitcoin Markets (bitstampUSD) https://www.quandl.com/data/BCHARTS/BITSTAMPUSD-Bitcoin-Markets-bitstampUSD