current_market: Current market data

Description Usage Arguments Details Value Examples

View source: R/current_market.R

Description

Retrieves current market data for a set of coins

Usage

1
current_market(coin_ids, vs_currency = "usd", max_attempts = 3)

Arguments

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 supported_coins() function.

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 supported_currencies() function. If an unsupported vs_currency is requested, the call will fail with the respective error message.

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.

Details

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.

Value

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:

Examples

1
2
3
4
5
r <- current_market(
  coin_ids = c("bitcoin", "ethereum", "cardano"),
  vs_currency = "usd"
)
print(r)

geckor documentation built on Nov. 1, 2021, 5:07 p.m.