Coin-specific market data for a given historical date
coin_history_snapshot(coin_id, date, vs_currencies = "usd", max_attempts = 3)
(character): ID of the coin of interest or a vector with several IDs.
The maximum number of coins that can be queried simultaneously is 30.
An up-to-date list of supported coins and their IDs can be retrieved
with the supported_coins()
function.
(Date): date of interest. If no data exist for the requested
date, nothing (NULL
) will be returned.
(character): a vector with
names of the reference currencies to express the price in, e.g.
c("usd", "eur", "btc")
. An up-to-date list of supported
vs_currencies
(both fiat and cryptocurrencies) can be obtained with
the supported_currencies()
function. If vs_currencies
contains at least one unsupported currency, the call will fail with the
respective error message.
(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.
A tibble with the following columns:
coin_id
(character): same as the argument coin_id
;
symbol
(character): symbol of the coin;
name
(character): common name of the coin;
date
(Date): same as the argument date
;
vs_currency
(character): reference currency, in which the price
is expressed (ordered alphabetically);
price
(double): price of the coin;
market_cap
(double): market capitalisation of the coin;
total_volume
(double): total trading volume recorded on that date
.
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.
# NOT RUN {
r <- coin_history_snapshot(
coin_id = "cardano",
date = as.Date("2021-05-01"),
vs_currencies = c("usd", "eth")
)
print(r)
# }
Run the code above in your browser using DataLab