View source: R/endpoint_rates.R
get_exchangerate_from | R Documentation |
Retrieves the exchange rate from a specific date.
get_exchangerate_from(table, currency_code, date)
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. |
date |
date from which the exchange rate should be fetched. |
As exchange rates are not published on the weekends fetching values from a weekend date will result in a 404 error. In those cases the function returns an error with an appropriate message.
nbp_api_response object containing the exchange rate from the specified date.
https://api.nbp.pl/#kursyWalut
Other rates:
get_current_exchangerate()
,
get_exchangerate_from_interval()
,
get_last_n_exchangerates()
,
get_todays_exchangerate()
tryCatch(
{
## Fetch the euro exchange rate from a week ago
response <- get_exchangerate_from("A", "EUR", Sys.Date() - 7)
## Preview response content
response$content
},
error = function(e) message(e)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.