Retrieves TRX market data for a specific date (price, market cap, high/low, etc.)

get_trx_market_data_for_date(
  date,
  vs_currencies = c("usd", "eur"),
  max_attempts = 3L
)

Arguments

date

(character, Date or POSIXct): date to retrieve the data for. Expected format: %Y-%m-%d. Please note that the minimal acceptable date is 2017-11-09 as no data are available for earlier dates. Attempts to retrieve data for earlier dates will fail with the corresponding error. Attempts to request a future date, for which no history exists yet, will fail as well.

vs_currencies

(character): a vector with names of the base currencies to benchmark TRX against, e.g. c("usd", "eur", "btc"). An up-to-date list of supported currencies (both fiat and cryptocurrencies) can be retrieved with the get_supported_coingecko_currencies() function. If vs_currencies contains at least one unsupported currency, the call will fail with the respective error message.

max_attempts

(integer, positive): specifies the maximum number of additional attempts to call a URL if the first attempt fails (i.e. its call status is different from 200). Additional attempts are implemented with an exponential backoff. Defaults to 3.

Value

A tibble with as many rows as the length of vs_currencies and the following columns:

  • date (Date): same as date;

  • vs_currency (character): same as vs_currencies;

  • market_cap (double): market cap as of date;

  • total_trading_vol (double): total trading volume on date;

  • price (double): average price on date.

Examples

r <- get_trx_market_data_for_date(date = Sys.Date() - 1) print(r)
#> # A tibble: 2 x 5 #> date vs_currency market_cap total_trading_vol price #> <date> <chr> <dbl> <dbl> <dbl> #> 1 2021-07-11 usd 4416356903. 794567260. 0.0616 #> 2 2021-07-11 eur 3718413524. 668997029. 0.0519