Retrieves TRX open-high-low-close price data for the last n days

get_trx_ohlc_data_for_last_n_days(vs_currency = "usd", days, 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.

days

(numeric or "max"): number of days to look back. The only acceptable values are 1, 7, 14, 30, 90, 180, 365 and "max". Attempts to assign any other values will fail with the corresponding console message. If days = "max", the entire available history will be retrieved. If the requested number of days covers dates before 2017-11-09, the retrived data will be clipped at 2017-11-09 (the beginning of history for TRX). Depending on the value of days, the time interval used to present the data will differ - see "Details".

max_attempts

function_params("max_attempts")

Value

A tibble with the following columns:

  • timestamp (POSIXct): timestamp;

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

  • price_open (double): TRX price in the beginning of a time iterval;

  • price_high (double): highest TRX price observed within a time interval;

  • price_low (double): lowest TRX price observed within a time interval;

  • price_close (double): TRX price in the end of a time interval.

Details

Granularity of the retrieved data (i.e. candle's body) depends on the number of requested days as follows:

  • 1 day: 30 minutes

  • 7 - 30 days: 4 hours

  • 31 and above: 4 days

Examples

r <- get_trx_ohlc_data_for_last_n_days(days = 7) print(r)
#> # A tibble: 43 x 6 #> timestamp vs_currency price_open price_high price_low price_close #> <dttm> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 2021-07-06 00:00:00 usd 0.0654 0.0654 0.0654 0.0654 #> 2 2021-07-06 04:00:00 usd 0.0649 0.0656 0.0649 0.065 #> 3 2021-07-06 08:00:00 usd 0.0651 0.0663 0.0651 0.0662 #> 4 2021-07-06 12:00:00 usd 0.0664 0.0664 0.0649 0.0649 #> 5 2021-07-06 16:00:00 usd 0.0656 0.0658 0.0648 0.0648 #> 6 2021-07-06 20:00:00 usd 0.0649 0.0649 0.0646 0.0648 #> 7 2021-07-07 00:00:00 usd 0.0648 0.0648 0.0642 0.0647 #> 8 2021-07-07 04:00:00 usd 0.0650 0.0651 0.0648 0.0650 #> 9 2021-07-07 08:00:00 usd 0.0654 0.0657 0.0654 0.0656 #> 10 2021-07-07 12:00:00 usd 0.0656 0.0658 0.0656 0.0657 #> # … with 33 more rows