Skip to content

Instantly share code, notes, and snippets.

@data-enhanced
Last active January 10, 2018 14:13
Show Gist options
  • Select an option

  • Save data-enhanced/16f5bfd9626f774c95636c4709b8d328 to your computer and use it in GitHub Desktop.

Select an option

Save data-enhanced/16f5bfd9626f774c95636c4709b8d328 to your computer and use it in GitHub Desktop.

Revisions

  1. David Cochran revised this gist Jan 10, 2018. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions crypto-scraper.R
    Original file line number Diff line number Diff line change
    @@ -3,16 +3,19 @@

    # This script is written to be used by running the desired line(s) separately, often one line at a time

    # Install package in Rstudio
    # 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
    # Get all coins
    # This will get all data for all coins in one dataframe
    coindata <- getCoins()

    # If desired, provide the cryptocurrency name as an argument to limit scrape
    # 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')
  2. David Cochran created this gist Jan 10, 2018.
    40 changes: 40 additions & 0 deletions crypto-scraper.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    # 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 package in Rstudio
    install.packages("devtools")
    devtools::install_github("jessevent/crypto")
    library(crypto)

    # Create dataframe from the getCoins() function
    # Get all coins
    coindata <- getCoins()

    # If desired, provide the cryptocurrency name as an argument to limit scrape
    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")