Skip to contents

Retrieve the monthly exchange rate fixing for less commonly traded ("other") currencies from the CNB API. These currencies are not part of the daily fixing returned by cnb_fx_rates().

Usage

cnb_fx_other_rates(year_month = NULL, year = NULL, lang = "EN")

Arguments

year_month

(NULL | character(1))
The month to query in "YYYY-MM" format, returning rates for all currencies in that month. If NULL, the latest available month is returned. Mutually exclusive with year. Default NULL.

year

(NULL | integer(1))
A calendar year, returning rates for all currencies in every month of that year. Mutually exclusive with year_month. Default NULL.

lang

(character(1))
Language for the country and currency names, either "EN" or "CZ". Default "EN".

Value

A data.table::data.table() with the requested exchange rates. The rate is the amount of Czech koruna per amount units of the foreign currency.

Examples

# \donttest{
# latest month for all other currencies
cnb_fx_other_rates()
#> Empty data.table (0 rows and 6 cols): date,currency_code,currency,country,amount,rate

# a specific month
cnb_fx_other_rates(year_month = "2024-01")
#>            date currency_code currency     country amount   rate
#>          <Date>        <char>   <char>      <char>  <int>  <num>
#>   1: 2024-01-31           AFN  afghani Afghanistan    100 31.052
#>   2: 2024-01-31           ALL      lek     Albania    100 24.016
#>   3: 2024-01-31           DZD    dinar     Algeria    100 17.069
#>   4: 2024-01-31           AOA   kwanza      Angola    100  2.717
#>   5: 2024-01-31           ARS     peso   Argentina    100  2.776
#>  ---                                                            
#> 120: 2024-01-31           VEF  bolivar   Venezuela      1  0.000
#> 121: 2024-01-31           VND     dong     Vietnam  10000  9.394
#> 122: 2024-01-31           YER     rial       Yemen    100  9.175
#> 123: 2024-01-31           ZMW   kwacha      Zambia      1  0.848
#> 124: 2024-01-31           ZWL   dollar    Zimbabwe   1000  0.000

# all months of a given year
cnb_fx_other_rates(year = 2024L)
#>             date currency_code  currency                 country amount   rate
#>           <Date>        <char>    <char>                  <char>  <int>  <num>
#>    1: 2024-01-31           AED    dirham    United Arab Emirates      1  6.245
#>    2: 2024-01-31           AFN   afghani             Afghanistan    100 31.052
#>    3: 2024-01-31           ALL       lek                 Albania    100 24.016
#>    4: 2024-01-31           AMD      dram                 Armenia    100  5.719
#>    5: 2024-01-31           ANG   guilder Curacao and St. Maarten      1 12.885
#>   ---                                                                         
#> 1484: 2024-12-31           XOF franc CFA                   BCEAO    100  3.872
#> 1485: 2024-12-31           XPF franc CFP        French Polynesia    100 21.158
#> 1486: 2024-12-31           YER      rial                   Yemen    100  9.731
#> 1487: 2024-12-31           ZMW    kwacha                  Zambia      1  0.873
#> 1488: 2024-12-31           ZWL    dollar                Zimbabwe   1000  0.000
# }