Description Usage Arguments Details Value Examples
View source: R/coin_history_range.R
Retrieves coin-specific market data for a range of historical dates
1 | coin_history_range(coin_id, vs_currency = "usd", from, to, 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 30.
An up-to-date list of supported coins and their IDs can be retrieved
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 |
from |
(POSIXct): timestamp of the beginning of the period of interest
( |
to |
(POSIXct): timestamp of the end of the period of interest
( |
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 returns hourly data for periods of up to 90 days and daily data for periods that are longer than 90 days.
Sometimes, the retrieved data will contain missing values. In such cases, the function will issue a warning and show a list of columns that have missing values.
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.
A tibble with the following columns:
timestamp
(POSIXct);
coin_id
(character): same as the argument coin_id
;
vs_currency
(character): same as the argument vs_currency
;
price
(double): coin price as of timestamp
;
total_volume
(double): a 24 hours rolling-window trading volume, as
of timestampt
;
market_cap
(double): market capitalisation, as of timestamp
.
1 2 3 4 5 6 7 | r <- coin_history_range(
coin_id = "cardano",
vs_currency = "usd",
from = as.POSIXct("2021-01-01 13:00:00", tz = "UTC"),
to = as.POSIXct("2021-01-01 18:00:00", tz = "UTC")
)
print(r)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.