get_last_n_exchangerates: Retrieves the last n exchange rates.

View source: R/endpoint_rates.R

get_last_n_exchangeratesR Documentation

Retrieves the last n exchange rates.

Description

Retrieves the last n exchange rates.

Usage

get_last_n_exchangerates(table, currency_code, n)

Arguments

table

specifies which from which table the exchange rate should be fetched.

currency_code

code of the currency for which the exchange rate should be fetched.

n

number of exchange rates to retrieve.

Value

nbp_api_response object containing the last n exchange rates.

See Also

https://api.nbp.pl/#kursyWalut

Other rates: get_current_exchangerate(), get_exchangerate_from(), get_exchangerate_from_interval(), get_todays_exchangerate()

Examples


tryCatch(
  {
    ## Fetch the last 3 exhange rates for euros
    response <- get_last_n_exchangerates("A", "EUR", 3)
    ## Preview response content
    response$content
  },
  error = function(e) message(e)
)



szymanskir/rnbp documentation built on April 12, 2025, 8:51 p.m.