Retrieves TRX market data for a range of historical dates

get_trx_market_data_for_time_range(
  vs_currency = "usd",
  min_timestamp,
  max_timestamp,
  max_attempts = 3L
)

Arguments

vs_currency

(character): name of the base currency to benchmark TRX against (usd by default). An up-to-date list of supported currencies (both fiat and cryptocurrencies) can be retrieved with the get_supported_coingecko_currencies() function. If an unsupported vs_currency is requested, the call will fail with the respective error message.

min_timestamp

(numeric or character): a Unix timestamp (including milliseconds), which defines the beginning of the period of interest (inclusive). Defaults to 0.

max_timestamp

(numeric or character): a Unix timestamp (including milliseconds), which defines the end of the period of interest (inclusive).

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 the following columns:

  • timestamp (POSIXct);

  • vs_currency (character): same as the argument vs_currency;

  • price (double): TRX price, as of datetime;

  • total_trading_vol (double): a 24 h rolling-window trading volume, as of timestampt;

  • market_cap (double): TRX market cap, as of timestamp.

Details

This function returns hourly data for periods of up to 90 days, and daily data for periods above 90 days.

The minimal acceptable min_timestamp is "1510185600000" (which corresponds to 2017-11-09 00:00:00) as no data are available for earlier dates. Attempts to retrieve data for earlier dates will fail with the corresponding error message.

Attempts to request a future max_timestamp for which no history exists yet will also fail with the corresponding error message.

Examples

r <- get_trx_market_data_for_time_range( vs_currency = "eur", min_timestamp = "1609495210000", max_timestamp = "1609533900000" ) print(r)
#> # A tibble: 11 x 5 #> timestamp vs_currency price total_trading_vol market_cap #> <dttm> <chr> <dbl> <dbl> <dbl> #> 1 2021-01-01 10:29:22 eur 0.0222 654573570. 1594168100. #> 2 2021-01-01 11:28:07 eur 0.0223 641862258. 1597089730. #> 3 2021-01-01 12:30:03 eur 0.0224 642318304. 1593613228. #> 4 2021-01-01 13:21:14 eur 0.0223 631960114. 1594847164. #> 5 2021-01-01 14:07:59 eur 0.0223 624479142. 1601164342. #> 6 2021-01-01 15:26:23 eur 0.0224 623512377. 1598862382. #> 7 2021-01-01 16:24:40 eur 0.0223 618019263. 1597682803. #> 8 2021-01-01 17:26:22 eur 0.0224 617045405. 1604783013. #> 9 2021-01-01 18:28:35 eur 0.0222 592113206. 1594935074. #> 10 2021-01-01 19:27:59 eur 0.0220 597989280. 1577179895. #> 11 2021-01-01 20:29:06 eur 0.0221 624294518. 1582333694.