get_todays_exchangerate: Retrieves the exchange rate that was published today.

View source: R/endpoint_rates.R

get_todays_exchangerateR Documentation

Retrieves the exchange rate that was published today.

Description

Retrieves the exchange rate that was published today.

Usage

get_todays_exchangerate(table, currency_code)

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.

Details

If today's data is not available the API will return a 404 Not found error. In that case the function will return an error with an appropriate message.

Value

nbp_api_response object containing today's exchange rate.

See Also

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

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

Examples


tryCatch(
  {
    ## Fetch todays A exchange rate table
    response <- get_todays_exchangerate("A", "EUR")
    ## Preview response content
    response$content
  },
  error = function(e) message(e)
)



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