Last active
January 10, 2018 14:13
-
-
Save data-enhanced/16f5bfd9626f774c95636c4709b8d328 to your computer and use it in GitHub Desktop.
Cryptocurrency data scraper in R -- script to utilize JesseVent/crypto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install and use crypto scraper from | |
# https://github.com/JesseVent/crypto | |
# This script is written to be used by running the desired line(s) separately, often one line at a time | |
# Install jessevent/crypto package in Rstudio | |
# If you do not have devtools installed, install devtools first | |
install.packages("devtools") | |
# Now install jessevent/crypto | |
devtools::install_github("jessevent/crypto") | |
library(crypto) | |
# Create dataframe from the getCoins() function | |
# This will get all data for all coins in one dataframe | |
coindata <- getCoins() | |
# If desired, provide the cryptocurrency name as an argument | |
# to limit the scrape to a specific cryptocurrency. | |
bitcoin_data <- getCoins('bitcoin') | |
ethereum_data <- getCoins('ethereum') | |
ripple_data <- getCoins('ripple') | |
# View head of dataframe | |
head(coindata, n=10) | |
head(bitcoin_data, n=10) | |
head(ethereum_data, n=10) | |
head(ripple_data, n=10) | |
# Write to CSV file | |
# Update file name as desired! | |
# All coins | |
# update file name as desired to include desired path, such as "~/CryptoScraper/coindata.csv" | |
write.csv(coindata, "coindata.csv") | |
# Bitcoin | |
write.csv(bitcoin_data, "bitcoin_data.csv") | |
# Ethereum | |
write.csv(ethereum_data, "ethereum_data.csv") | |
# Ripple | |
write.csv(ripple_data, "ripple_data.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment