Closed haquer closed 5 years ago
This is what I had to do in order to get this data:
library(tidyverse)
library(rvest)
library(httr)
library(jsonlite)
#define the url
bc_url <- "https://bittrex.com/api/v1.1/public/getcurrencies"
#request the data from the website
bc_return <- GET(bc_url)
#parse the data into text
bc_content <- content(bc_return, "text")
# save the date information from the header as there is no date info in payload
trade_day <- bc_return$date
#pull out the data as a json
con <- fromJSON(bc_content)[["result"]]
#add the date field back in
final_data <- cbind(con, trade_day = trade_day)
# to save to a master file
write_csv(final_data, "my_data.csv")
# or to save to a daily file
write_csv(final_data, paste0(Sys.Date(),"_my_data.csv")
This is just daily so if you want to append it to a master file instead of write_csv
you could do:
write_csv(final_data, path, append = TRUE)
and it would tack on each day making a longer csv.
If you save each day as a unique file (most safe in my book) you could then pull them back together with
my_files <- list.files(pattern = "my_data.csv")
complete_data <- map_dfc(my_files, read_csv)
I just stumbled across this R package for accessing data from Bittrex which might be of interest to you. https://github.com/ropensci/bittrex
Thank you!
On Mon, Dec 17, 2018 at 4:12 PM Jerid Francom notifications@github.com wrote:
I just stumbled across this R package for accessing data from Bittrex which might be of interest to you. https://github.com/ropensci/bittrex
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/WFU-TLC/flc_discussion_board/issues/3#issuecomment-447879365, or mute the thread https://github.com/notifications/unsubscribe-auth/Aih8hhQzr8Woe9s66OUFm-SXhd5UCB7Tks5u57RrgaJpZM4YaQyd .
-- Raina S. Haque, J.D. Professor of Practice 🡒 Computational Law + Emergent Technologies Wake Forest University School of Law Office Hours Scheduler https://calendly.com/meet-erdos/law469/ Erdős Intellectual Property Law + Startup Legal http://www.erdosiplaw.com/ LinkedIn https://www.linkedin.com/in/rainahaque @greatrescission
Specifically: https://bittrex.com/api/v1.1/public/getcurrencies