Title: | Get 'Cryptocurrencies' Market Cap Prices from Coin Market Cap |
---|---|
Description: | Extract and monitor price and market cap of 'Cryptocurrencies' from 'Coin Market Cap' <https://coinmarketcap.com/api/>. |
Authors: | AbdulMajedRaja RS [aut, cre], Sebastian Gatscha [aut, ctb] |
Maintainer: | AbdulMajedRaja RS <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4 |
Built: | 2024-11-03 03:19:44 UTC |
Source: | https://github.com/amrrs/coinmarketcapr |
Extract and monitor price and market cap of 'Cryptocurrencies' from 'CoinMarketCap' https://coinmarketcap.com/api/ that lists many leading cryptocurrencies along with their price, 24h trade volume, market cap and much more in USD and other currencies.
Useful links:
Report bugs at https://github.com/amrrs/coinmarketcapr/issues
Returns API key details and usage stats. This endpoint can be used to programmatically monitor your key usage compared to the rate limit and daily/monthly credit limits available to your API plan. You may use the Developer Portal's account dashboard as an alternative to this endpoint.
get_api_info()
get_api_info()
A dataframe with all API key infos
## Not run: get_api_info() ## End(Not run)
## Not run: get_api_info() ## End(Not run)
Get a paginated list of all active cryptocurrencies with latest market data. The default "market_cap" sort returns cryptocurrency in order of CoinMarketCap's market cap rank (as outlined in our methodology) but you may configure this call to order by another market ranking field. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
get_crypto_listings(currency = "USD", latest = TRUE, ...)
get_crypto_listings(currency = "USD", latest = TRUE, ...)
currency |
currency code - Default is 'USD' |
latest |
If 'TRUE' (default), only the latest data is retrieved, otherwise historical data is returned. (NOTE: Historic Data require higher API rights) |
... |
Further arguments can be passed to historical data. Further information can be found in the API documentation |
A dataframe of top Cryptocurrencies with current or historic market data
Other Cryptocurrencies:
get_crypto_map()
,
get_crypto_marketpairs()
,
get_crypto_meta()
,
get_crypto_ohlcv()
,
get_crypto_quotes()
,
get_marketcap_ticker_all()
,
get_valid_currencies()
## Not run: get_crypto_listings('EUR') get_crypto_listings('GBP') get_crypto_listings('GBP', latest=F, start=1, date=Sys.Date()-20, limit=10, sort="price", sort_dir="asc") ## End(Not run)
## Not run: get_crypto_listings('EUR') get_crypto_listings('GBP') get_crypto_listings('GBP', latest=F, start=1, date=Sys.Date()-20, limit=10, sort="price", sort_dir="asc") ## End(Not run)
Get all active cryptocurrencies supported by the platform including a unique id
get_crypto_map(...)
get_crypto_map(...)
... |
Further arguments passed to the request. Further information can be found in the API documentation |
A dataframe with all active cryptocurrencies supported by the platform including a unique id for each cryptocurrency.
Other Cryptocurrencies:
get_crypto_listings()
,
get_crypto_marketpairs()
,
get_crypto_meta()
,
get_crypto_ohlcv()
,
get_crypto_quotes()
,
get_marketcap_ticker_all()
,
get_valid_currencies()
## Not run: get_crypto_map() get_crypto_map(symbol="BTC") get_crypto_map(symbol=c("BTC","ETH")) get_crypto_map(listing_status = "active", start = 1, limit = 10) get_crypto_map(listing_status = "inactive", start = 1, limit = 10) ## End(Not run)
## Not run: get_crypto_map() get_crypto_map(symbol="BTC") get_crypto_map(symbol=c("BTC","ETH")) get_crypto_map(listing_status = "active", start = 1, limit = 10) get_crypto_map(listing_status = "inactive", start = 1, limit = 10) ## End(Not run)
Get a list of all active market pairs that CoinMarketCap tracks for a given cryptocurrency or fiat currency
get_crypto_marketpairs( currency = "USD", symbol = NULL, id = NULL, slug = NULL, start = NULL, limit = NULL )
get_crypto_marketpairs( currency = "USD", symbol = NULL, id = NULL, slug = NULL, start = NULL, limit = NULL )
currency |
currency code - Default is 'USD' |
symbol |
One or more cryptocurrency symbols. Example: c("BTC","ETH"). |
id |
Alternatively pass one or more CoinMarketCap cryptocurrency IDs. Example: c(1,2) |
slug |
Alternatively pass a vector of exchange slugs. Example: c("binance","cryptsy") |
start |
Optionally offset the start (1-based index) of the paginated list of items to return. - Default is 1 |
limit |
Optionally specify the number of results to return. Use this parameter and the "start" parameter to determine your own pagination size. |
A dataframe with all active market pairs
A single cryptocurrency "id", "slug", or "symbol" is required.
Other Cryptocurrencies:
get_crypto_listings()
,
get_crypto_map()
,
get_crypto_meta()
,
get_crypto_ohlcv()
,
get_crypto_quotes()
,
get_marketcap_ticker_all()
,
get_valid_currencies()
## Not run: get_crypto_marketpairs("EUR") get_crypto_marketpairs("EUR", slug = "bitcoin") get_crypto_marketpairs("EUR", symbol = "LTC") get_crypto_marketpairs("EUR", symbol = "BTC", start = 10, limit = 20) ## End(Not run)
## Not run: get_crypto_marketpairs("EUR") get_crypto_marketpairs("EUR", slug = "bitcoin") get_crypto_marketpairs("EUR", symbol = "LTC") get_crypto_marketpairs("EUR", symbol = "BTC", start = 10, limit = 20) ## End(Not run)
Get all static metdata available for one or more cryptocurrencies
get_crypto_meta(symbol = NULL, id = NULL, slug = NULL)
get_crypto_meta(symbol = NULL, id = NULL, slug = NULL)
symbol |
One or more cryptocurrency symbols. Example: c("BTC","ETH"). |
id |
Alternatively pass one or more CoinMarketCap cryptocurrency IDs. Example: c(1,2) |
slug |
Alternatively pass a vector of exchange slugs. Example: c("binance","cryptsy") |
A dataframe with metadata of Cryptocurrencies
At least one "id" or "slug" or "symbol" is required for this request.
Other Cryptocurrencies:
get_crypto_listings()
,
get_crypto_map()
,
get_crypto_marketpairs()
,
get_crypto_ohlcv()
,
get_crypto_quotes()
,
get_marketcap_ticker_all()
,
get_valid_currencies()
## Not run: get_crypto_meta() get_crypto_meta(symbol = c("BTC","ETH")) get_crypto_meta(id = c(1,2,3,4)) get_crypto_meta(slug = c("bitcoin", "ethereum")) ## End(Not run)
## Not run: get_crypto_meta() get_crypto_meta(symbol = c("BTC","ETH")) get_crypto_meta(id = c(1,2,3,4)) get_crypto_meta(slug = c("bitcoin", "ethereum")) ## End(Not run)
Return the latest/historical OHLCV (Open, High, Low, Close, Volume) market values for one or more cryptocurrencies for the current UTC day. Since the current UTC day is still active these values are updated frequently. You can find the final calculated OHLCV values for the last completed UTC day along with all historic days using /cryptocurrency/ohlcv/historical.
get_crypto_ohlcv( currency = "USD", latest = TRUE, symbol = NULL, id = NULL, ... )
get_crypto_ohlcv( currency = "USD", latest = TRUE, symbol = NULL, id = NULL, ... )
currency |
currency code - Default is 'USD' |
latest |
If 'TRUE' (default), only the latest data is retrieved, otherwise historical data is returned. |
symbol |
One or more cryptocurrency symbols. Example: c("BTC","ETH"). |
id |
Alternatively pass one or more CoinMarketCap cryptocurrency IDs. Example: c(1,2) |
... |
Further arguments passed to the request. Further information can be found in the API documentation |
A dataframe with OHLCV values
One of "id" or "symbol" is required for this request.
Other Cryptocurrencies:
get_crypto_listings()
,
get_crypto_map()
,
get_crypto_marketpairs()
,
get_crypto_meta()
,
get_crypto_quotes()
,
get_marketcap_ticker_all()
,
get_valid_currencies()
## Not run: get_crypto_ohlcv("EUR") get_crypto_ohlcv("EUR", latest = F) get_crypto_ohlcv("EUR", latest = F, time_period = "hourly", time_start=Sys.Date()-180, count=5, interval="monthly") ## End(Not run)
## Not run: get_crypto_ohlcv("EUR") get_crypto_ohlcv("EUR", latest = F) get_crypto_ohlcv("EUR", latest = F, time_period = "hourly", time_start=Sys.Date()-180, count=5, interval="monthly") ## End(Not run)
Get the latest/historical market quotes for 1 or more cryptocurrencies
get_crypto_quotes( currency = "USD", symbol = NULL, slug = NULL, id = NULL, latest = TRUE, ... )
get_crypto_quotes( currency = "USD", symbol = NULL, slug = NULL, id = NULL, latest = TRUE, ... )
currency |
currency code - Default is 'USD' |
symbol |
One or more cryptocurrency symbols. Example: c("BTC","ETH"). |
slug |
Alternatively pass a vector of exchange slugs. Example: c("binance","cryptsy") |
id |
Alternatively pass one or more CoinMarketCap cryptocurrency IDs. Example: c(1,2) |
latest |
If 'TRUE' (default), only the latest data is retrieved, otherwise historical data is returned. (NOTE: Historic Data require higher API rights) |
... |
Further arguments can be passed to historical data. Further information can be found in the API documentation |
A dataframe with the latest market quote for 1 or more cryptocurrencies
At least one "id" or "slug" or "symbol" is required for this request.
Other Cryptocurrencies:
get_crypto_listings()
,
get_crypto_map()
,
get_crypto_marketpairs()
,
get_crypto_meta()
,
get_crypto_ohlcv()
,
get_marketcap_ticker_all()
,
get_valid_currencies()
## Not run: get_crypto_quotes() get_crypto_quotes(symbol="ETH") get_crypto_quotes(symbol=c("ETH","BTC")) get_crypto_quotes(slug=c("litecoin","dogecoin")) get_crypto_quotes("EUR", id=c(3,4)) get_crypto_quotes(latest = FALSE, symbol = c("BTC","ETH"), time_start = Sys.Date()-180, time_end=Sys.Date(), count = 10, interval = "30m") ## End(Not run)
## Not run: get_crypto_quotes() get_crypto_quotes(symbol="ETH") get_crypto_quotes(symbol=c("ETH","BTC")) get_crypto_quotes(slug=c("litecoin","dogecoin")) get_crypto_quotes("EUR", id=c(3,4)) get_crypto_quotes(latest = FALSE, symbol = c("BTC","ETH"), time_start = Sys.Date()-180, time_end=Sys.Date(), count = 10, interval = "30m") ## End(Not run)
Returns a paginated list of all cryptocurrency exchanges by CoinMarketCap ID. We recommend using this convenience endpoint to lookup and utilize our unique exchange id across all endpoints as typical exchange identifiers may change over time. As a convenience you may pass a comma-separated list of exchanges by slug to filter this list to only those you require.
get_exchange_map(...)
get_exchange_map(...)
... |
Further arguments passed to the request. Further information can be found in the API documentation |
A dataframe with exchange values
Other Exchanges:
get_exchange_meta()
## Not run: get_exchange_map() get_exchange_map(listing_status = "inactive", slug = "binance", start = 5, limit = 100) ## End(Not run)
## Not run: get_exchange_map() get_exchange_map(listing_status = "inactive", slug = "binance", start = 5, limit = 100) ## End(Not run)
Returns all static metadata for one or more exchanges. This information includes details like launch date, logo, official website URL, social links, and market fee documentation URL.
get_exchange_meta(id = NULL, slug = NULL)
get_exchange_meta(id = NULL, slug = NULL)
id |
Alternatively pass one or more CoinMarketCap cryptocurrency IDs. Example: c(1,2) |
slug |
Alternatively pass a vector of exchange slugs. Example: c("binance","cryptsy") |
A dataframe with exchange metadata values
Other Exchanges:
get_exchange_map()
## Not run: get_exchange_meta(id = 5) get_exchange_meta(slug = c("binance", "cryptsy")) ## End(Not run)
## Not run: get_exchange_meta(id = 5) get_exchange_meta(slug = c("binance", "cryptsy")) ## End(Not run)
Extract Global Market Cap of Cryptocurrency Market
get_global_marketcap(currency = "USD", latest = TRUE, ...)
get_global_marketcap(currency = "USD", latest = TRUE, ...)
currency |
currency code - Default is 'USD' |
latest |
If 'TRUE' (default), only the latest data is retrieved, otherwise historical data is returned. (NOTE: Historic Data require higher API rights) |
... |
Further arguments can be passed to historical data. Further information can be found in the API documentation |
A dataframe with global market cap of Cryptocurrencies
## Not run: get_global_marketcap('AUD') get_global_marketcap('EUR') get_global_marketcap(latest = FALSE, count = 10, interval = "yearly", time_start = Sys.Date()-180, time_end = Sys.Date()) ## End(Not run)
## Not run: get_global_marketcap('AUD') get_global_marketcap('EUR') get_global_marketcap(latest = FALSE, count = 10, interval = "yearly", time_start = Sys.Date()-180, time_end = Sys.Date()) ## End(Not run)
Convert an amount of one cryptocurrency or fiat currency into one or more different currencies utilizing the latest market rate for each currency. You may optionally pass a historical timestamp as time to convert values based on historical rates (as your API plan supports).
get_price_conversion(amount = NULL, id, symbol, time, convert, convert_id)
get_price_conversion(amount = NULL, id, symbol, time, convert, convert_id)
amount |
An amount of currency to convert. Example: 10.43 |
id |
The CoinMarketCap currency ID of the base cryptocurrency or fiat to convert from.
If |
symbol |
Alternatively the currency symbol of the base cryptocurrency or fiat to convert from.
One |
time |
Optional timestamp to reference historical pricing during conversion. If not passed, the current time will be used. If passed, we'll reference the closest historic values available for this conversion. |
convert |
Pass up to 120 comma-separated fiat or cryptocurrency symbols to convert the source amount to. Default is 'USD'. |
convert_id |
Optionally calculate market quotes by CoinMarketCap ID instead of symbol. This option is identical to convert outside of ID format. Ex: convert_id=1,2781 would replace convert=BTC,USD in your query. This parameter cannot be used when convert is used. |
Cache / Update frequency:Every 60 seconds for the lastest cryptocurrency and fiat currency rates. Plan credit use: 1 call credit per call and 1 call credit per convert option beyond the first. CMC equivalent pages: Our cryptocurrency conversion page at converter.
A dataframe with price conversion information
## Not run: get_price_conversion(1) get_price_conversion(amount = 1, symbol = "BTC", convert = c("EUR","LTC","USD")) get_price_conversion(amount = 1, id=1, time = Sys.Date()-100) ## End(Not run)
## Not run: get_price_conversion(1) get_price_conversion(amount = 1, symbol = "BTC", convert = c("EUR","LTC","USD")) get_price_conversion(amount = 1, id=1, time = Sys.Date()-100) ## End(Not run)
Get Valid Currencies
get_valid_currencies()
get_valid_currencies()
A character vector of valid currencies supported by coinmarketcap API
Other Cryptocurrencies:
get_crypto_listings()
,
get_crypto_map()
,
get_crypto_marketpairs()
,
get_crypto_meta()
,
get_crypto_ohlcv()
,
get_crypto_quotes()
,
get_marketcap_ticker_all()
get_valid_currencies()
get_valid_currencies()
Plot The Price of the Largest Market Cap Cryptocurrencies (API Key required)
plot_top_currencies(currency = "USD", k = 5, bar_color = "grey")
plot_top_currencies(currency = "USD", k = 5, bar_color = "grey")
currency |
currency code (default is 'USD') |
k |
the number of top cryptocurrencies to plot (default is 5) |
bar_color |
a valid color name or hexadecimal color code (default is 'grey') |
A ggplot of top Cryptocurrencies based on their rank (Market Cap)
## Not run: plot_top_currencies('EUR') plot_top_currencies('GBP') ## End(Not run)
## Not run: plot_top_currencies('EUR') plot_top_currencies('GBP') ## End(Not run)
Specifies API Key and the base URL for session
setup(api_key = NULL, sandbox = FALSE) get_setup() reset_setup(api_key = TRUE, sandbox = TRUE)
setup(api_key = NULL, sandbox = FALSE) get_setup() reset_setup(api_key = TRUE, sandbox = TRUE)
api_key |
Your Coinmarketcap API key. |
sandbox |
Sets the base URL for the API. If set to TRUE, the sandbox-API is called. The default is FALSE. |
setup("xXXXXxxxXXXxx") get_setup()
setup("xXXXXxxxXXXxx") get_setup()