View source: R/coin_history_snapshot.R
coin_history_snapshot | R Documentation |
Coin-specific market data for a given historical date
coin_history_snapshot(coin_id, date, vs_currencies = "usd", max_attempts = 3)
coin_id |
(character): ID of the coin of interest or a vector with several IDs.
The maximum number of coins that can be queried simultaneously is 5.
An up-to-date list of supported coins and their IDs can be retrieved
with the |
date |
(Date): date of interest. If no data exist for the requested
date, nothing ( |
vs_currencies |
(character): a vector with
names of the reference currencies to express the price in, e.g.
|
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. |
This function is based on the public CoinGecko API, which has a rate limit of 10-30 calls per minute. Please keep this limit in mind when developing your applications.
If the API call succeeds, the function returns 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
.
If no data can be retrieved (e.g., because of going over the API
rate limit or mis-specifying the query parameters), the function
returns nothing (NULL
).
r <- coin_history_snapshot(
coin_id = "cardano",
date = as.Date("2021-05-01"),
vs_currencies = c("usd", "eth")
)
print(r)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.