Description Usage Arguments Details Value Examples
View source: R/current_market.R
Retrieves current market data for a set of coins
1 | current_market(coin_ids, vs_currency = "usd", max_attempts = 3)
|
coin_ids |
(character): a vector with IDs of the coins of
interest. An up-to-date list of supported coins and their
IDs can be obtained with the |
vs_currency |
(character): name of the reference currency to
express the price in. An up-to-date list of supported reference currencies (both
fiat and cryptocurrencies) can be obtained with the |
max_attempts |
(double, positive): specifies the maximum number of attempts to call the CoinGecko API (e.g., if the first call fails for some reason). Additional attempts are implemented with an exponential backoff. Defaults to 3. |
If no data can be retrieved (e.g., because of a misspecified
query parameter), nothing (NULL
) will be returned.
This function is based on the public CoinGecko API, which has a limit of 50 calls per minute. Please keep this limit in mind when developing your applications.
If the requested data exist, this function will return a tibble with
as many rows as the length of coin_ids
and the following columns:
coin_id
(character): coin IDs, ordered by market_cap
(see below);
symbol
(character): symbol of the coin;
name
(character): common name of the coin;
vs_currency
(character): same as the argument vs_currency
;
last_updated_at
(POSIXct, UTC time zone): timestamp of the last update;
current_price
(double): current price (as of last_updated_at
)
expressed in vs_currency
;
market_cap
(double): current market capitalisation;
market_cap_rank
(integer): current rank of the coin in terms of its
market capitalisation;
fully_diluted_valuation
(double):
fully diluted valuation
of the coin's project;
total_volume
(double): total trading volume in the last 24 hours;
high_24h
(double): max price recorded in the last 24 hours;
low_24h
(double): min price recorded in the last 24 hours;
price_change_24h
(double): price change as compared to 24 hours ago;
price_change_percentage_24h
(double): percentage change of the price as
compared to 24 hours ago;
market_cap_change_24h
(double): market cap change as compared to 24 hours
ago;
market_cap_change_percentage_24h
(double): percentage change of the market
cap as compared to 24 hours ago;
circulating_supply
(double): coin supply currently in circulation;
total_supply
(double): total supply that can potentially be circulated;
max_supply
(double): max possible supply;
ath
(double): all-time high price;
ath_change_percentage
(double): percentage change of the all-time high
price compared to the current price;
ath_date
(POSIXct, UTC time zone): timestamp of when the all-time high
price was recorded;
atl
(double): all-time low price;
atl_change_percentage
(double): percentage change of the all-time low
price compared to the current price;
atl_date
(POSIXct, UTC timezone): timestamp of when the all-time low
price was recorded;
price_change_percentage_<time>_in_currency
: columns containing the
percentage change in price as compared to various points in the past
(in particular, 1 hour, 24 hours, 7 days, 14 days, 30 days, 200 days,
and 1 year).
1 2 3 4 5 | r <- current_market(
coin_ids = c("bitcoin", "ethereum", "cardano"),
vs_currency = "usd"
)
print(r)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.