Cryptocurrency Market Data

Retrieves crypto currency current and historical information as well as information on the exchanges they are listed on. For current and historical it will retrieve the daily open, high, low and close values for all crypto currencies. This retrieves the historical market data by web scraping tables provided by 'Cryptocurrency Market Capitalizations' < https://coinmarketcap.com>.


alt text Cran Cran Cran Cran Rdoc

Now providing support for the CMC professional API Easily interact with the professional API for CoinMarketCap through use of the keychain and rstudioapi packages.

Additional information on setup and usage can be found here. R-Studio and using Keyring

Retrieves all the open, high, low, close values for all cryptocurrencies. This retrieves data from CoinMarketCap's historical prices, exchange details and current prices API.

  • Retrieves historical crypto currency data crypto_history()
  • Retrieves current crypto currency prices crypto_prices()
  • Retrieves list of all crypto currencies crypto_list()
  • Retrieves all crypto exchanges and their listings crypto_exchanges()
  • Converts/summarises historical data into xts objects crypto_xts()
  • Inidividual crypto currency time series data crypto_timeseries()
  • Global markets time series data crypto_global_markets()

Prerequisites

Below are the high level dependencies for the package to install correctly.

R (>= 3.4.0), rvest, xml2

# Ubuntu 
sudo apt install libxml2-dev libcurl4-openssl-dev libssl-dev

Installing

The crypto R-package is installable through CRAN or through github.

# Installing via CRAN
install.packages("crypto", dependencies = TRUE)
 
# Installing via Github
devtools::install_github("jessevent/crypto")

Package Usage

These are the main functions that are added so far and a brief summary of what they do. Additional parameters are viewable in the documentation for each function.

Please note that CoinMarketCap have recently introduced a rate limiter on their service of 30 calls per minute, this package will now run slower to accomodate for the rate limit.

library(crypto)
 
# Retrieve crypto market history for all-to-n coins
?getCoins
will_i_get_rich <- crypto_history(limit=50)
 
# Retrieve crypto market history for specific coin
?getCoins
will_i_get_rich_from <- crypto_history("kin")
 
# Get list of coins and rank
?listCoins
rich_list <- crypto_list()
 
# Retrieve current crypto market details
?getPrices
am_i_rich_now <- crypto_prices()
 
# Retrieve exchange details for all coins or specific coin
?getExchanges
where_do_i_get_rich <- crypto_exchanges()
 
# Convert and/or summarise market history into xts object
?crypto2xts
when_will_i_get_rich <- crypto_xts(will_i_get_rich, "week")
 
# Get timeseries market data for token for displaying in charts
?daily_market
show_me_getting_rich <- crypto_timeseries('bitcoin')
 
# Get timeseries global market data for all coins or alt coins for displaying in charts
?global_market
show_me_everyone_getting_rich <- crypto_global_markets()

Package Issues

Please run the below before raising an issue, then include the output from sessionInfo()

crypto::repair_dependencies()
 
print(sessionInfo())

Built With 😻 R

  • Kaggle - Get this dataset on kaggle!
  • CoinSpot - Invest $AUD into Crypto today!
  • CoinMarketCap - Providing amazing data @CoinMarketCap
  • CRAN - The CRAN repository for crypto

Author/License

This project is licensed under the MIT License - see the <license.md> file for details</license.md>

Acknowledgments

  • Thanks to the team at https://coinmarketcap.com for the great work they do and to the team at CoinTelegraph where the images were sourced.

  • Please star this if you find it useful, and remember the crypto currency market is volatile by nature, please be responsible if trading.

  • If by chance you do manage to make your fortune through some game-changing model, I'd appreciate your consideration in the below :)

    ERC-20: 0x375923Bf82F0b728d23A5704261a6e16341fd860
    XRP: rK59semLsuJZEWftxBFhWuNE6uhznjz2bK
    LTC: LWpiZMd2cEyqCdrZrs9TjsouTLWbFFxwCj
    

News

Latest updates, fixes and news for the Crypto package

Cran Cran Cran Cran Rdoc](http://www.rdocumentation.org/packages/crypto)

crypto major release 1.1.0

  • Significant changes to entire package due to upgrade to CMC API.
  • Now supports use of the CoinMarketCap professional API.
  • All parallel processing functionality has been removed.
  • All deprecated functions now use their new name, and warnings for old names removed.
  • Better visualisation of progress bar and API key handling introduced.
  • Support for secure API key management through keychain and rstudioapi packages.
  • Enhanced error handling and support for rate limiter, including automatic reattempts.
  • Removed redundant functions no longer required.
  • Added helper functions to assist with dependency management.

crypto minor release 1.0.4

BUG FIX

  • added change to handle rate limiter of 30 calls a minute introduced by CoinMarketCap

crypto minor release 1.0.3

BUG FIX

  • turning off verbose mode from crypto_history() function
  • added additional check in encoding.R to not change locale for existing windows UTF-8 encoding

ENHANCEMENTS

  • functions will now accept a character vector of coin names
  • enhanced coin name handling
  • cleaned up warning messages of deprecation
  • added stop function for coins without data
  • removed printing of empty string

crypto major release 1.0.0

NEW FUNCTIONS

  • daily_market() Retrieve timeseries market data for specific token perfect for visualisation.
  • global_market() Retrieve timeseries global market data for all coins or alt-coins perfect for visualisation.
  • repair_dependencies() Repair all dependant packagess and install any missing ones.
  • replace_encoding() Converts locale encoding to use UTF-8 for better localisation and international support.
  • reset_encoding() Resets locale encoding back to system default.

RENAMED/DEPRECATED FUNCTIONS

The following functions have been renamed and will be deprecated in future versions. Functionality remains the same.

getCoins()      -----> crypto_history()
listCoins()     -----> crypto_list()
getExchanges()  -----> crypto_exchanges()
getPrices()     -----> crypto_prices()
crypto2xts      -----> crypto_xts()

crypto release 0.1.6


NEW FUNCTION crypto2xts()

  • Addition of crypto2xts() function to convert getCoins() into xts object
  • crypto2xts() can also be used to summarise into specified time periods i.e month, week

crypto release 0.1.5


ENHANCEMENT

  • Changed listCoins() url to the new coinmarketcap services
  • Added error handling to foreach call to prevent errors where coins may not exist

crypto release 0.1.4


BUG FIX

  • Fixed rounding issue in getCoins() & getPrices() by introducing replace_na from tidyr package
  • Fixed issue in getPrices() to do with currency conversion

crypto release 0.1.3


NEW FUNCTION getExchanges()

  • Addition of getExchanges() function to retrieve all crypto currencies and their listed exchanges

BUG FIX

  • Fixing defect in getPrices() function by adding return(prices)

crypto release 0.1.2


NEW FUNCTION getPrices()

  • Addition of getPrices() function to retrieve current crypto currency prices

BUG FIX

  • Minor updates to resolve CRAN errors on windows and linux

crypto release 0.1.1


ENHANCEMENT

  • Update to resolve check NOTES on different platforms.
  • Included additional parameters in getCoins() function

crypto release 0.1.0


NEW FUNCTIONS

  • Addition of getCoins() function to retrieve crypto currency prices
  • Addition of listCoins() function to retrieve list of crypto currencies
  • Addition of scraper() helper function used in getCoins()

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("crypto")

1.1.1 by Jesse Vent, 9 months ago


https://github.com/JesseVent/crypto, https://CRAN.R-project.org/package=crypto


Report a bug at https://github.com/JesseVent/crypto/issues


Browse source code at https://github.com/cran/crypto


Authors: Jesse Vent [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports dplyr, tibble, jsonlite, lubridate, xts, curl, utils, cli, crayon, progress, stats, tidyr, httr, rstudioapi

Depends on rvest, xml2

Suggests R6

System requirements: libxml2-devel, libcurl-devel, openssl-devel, libsecret-devel, libsodium-devel


See at CRAN