Title: | Client for Central Bank APIs |
Version: | 0.8.0 |
Description: | A client for retrieving data and metadata from major central bank APIs. It supports access to the 'Bundesbank SDMX Web Service API' (https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-data), the 'Swiss National Bank Data Portal' (https://data.snb.ch/en), the 'European Central Bank Data Portal API' (https://data.ecb.europa.eu/help/api/overview), the 'Bank of England Interactive Statistical Database' (https://www.bankofengland.co.uk/boeapps/database), the 'Banco de España API' (https://www.bde.es/webbe/en/estadisticas/recursos/api-estadisticas-bde.html), the 'Banque de France Web Service' (https://webstat.banque-france.fr/en/pages/guide-migration-api/), and 'Bank of Canada Valet API' (https://www.bankofcanada.ca/valet/docs). |
License: | MIT + file LICENSE |
URL: | https://m-muecke.github.io/bbk/, https://github.com/m-muecke/bbk |
BugReports: | https://github.com/m-muecke/bbk/issues |
Depends: | R (≥ 4.1.0) |
Imports: | checkmate, curl, data.table (≥ 1.17.0), httr2 (≥ 1.0.0), jsonlite, stats, utils, xml2 |
Suggests: | ggplot2, scales, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.3 |
NeedsCompilation: | yes |
Packaged: | 2025-10-01 16:23:21 UTC; mmuecke |
Author: | Maximilian Mücke |
Maintainer: | Maximilian Mücke <muecke.maximilian@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-10-01 16:40:08 UTC |
bbk: Client for Central Bank APIs
Description
A client for retrieving data and metadata from major central bank APIs. It supports access to the 'Bundesbank SDMX Web Service API' (https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-data), the 'Swiss National Bank Data Portal' (https://data.snb.ch/en), the 'European Central Bank Data Portal API' (https://data.ecb.europa.eu/help/api/overview), the 'Bank of England Interactive Statistical Database' (https://www.bankofengland.co.uk/boeapps/database), the 'Banco de España API' (https://www.bde.es/webbe/en/estadisticas/recursos/api-estadisticas-bde.html), the 'Banque de France Web Service' (https://webstat.banque-france.fr/en/pages/guide-migration-api/), and 'Bank of Canada Valet API' (https://www.bankofcanada.ca/valet/docs).
Author(s)
Maintainer: Maximilian Mücke muecke.maximilian@gmail.com (ORCID)
See Also
Useful links:
Report bugs at https://github.com/m-muecke/bbk/issues
Fetch Deutsche Bundesbank (BBk) data
Description
Retrieve time series data from the Bundesbank SDMX Web Service.
Usage
bbk_data(
flow,
key = NULL,
start_period = NULL,
end_period = NULL,
first_n = NULL,
last_n = NULL
)
Arguments
flow |
( |
key |
( |
start_period |
(
If |
end_period |
( |
first_n |
( |
last_n |
( |
Value
A data.table::data.table()
with the requested data.
Source
See Also
Other data:
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
# fetch all data for a given flow and key
data <- bbk_data("BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A")
head(data)
# fetch data for multiple keys
data <- bbk_data("BBEX3", c("M.ISK.EUR", "USD.CA.AC.A01"))
head(data)
# specified period (start date-end date) for daily data
data <- bbk_data(
"BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A",
start_period = "2020-01-01",
end_period = "2020-08-01"
)
head(data)
# or only specify the start date
data <- bbk_data(
"BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A",
start_period = "2024-04-01"
)
head(data)
Fetch Deutsche Bundesbank (BBk) metadata
Description
Retrieve metadata from the Bundesbank time series database via the SDMX Web Service.
Usage
bbk_metadata(type, id = NULL, lang = "en")
Arguments
type |
( |
id |
( |
lang |
( |
Value
A data.table::data.table()
with the requested metadata.
The columns are:
id |
The id of the metadata |
name |
The name of the metadata |
Source
See Also
Other metadata:
ecb_metadata()
,
onb_dimension()
,
onb_frequency()
,
onb_hierarchy()
,
onb_metadata()
,
onb_toc()
Examples
bbk_metadata("datastructure")
bbk_metadata("dataflow", "BBSIS")
bbk_metadata("codelist", "CL_BBK_ACIP_ASSET_LIABILITY")
bbk_metadata("concept", "CS_BBK_BSPL")
Fetch the Deutsche Bundesbank (BBk) series
Description
Retrieve a single series by its key via the Bundesbank SDMX Web Service.
Usage
bbk_series(key)
Arguments
key |
( |
Value
A data.table::data.table()
with the requested data.
Source
See Also
bbk_data()
for an endpoint with more options.
Other data:
bbk_data()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
bbk_series("BBEX3.M.DKK.EUR.BB.AC.A01")
bbk_series("BBAF3.Q.F41.S121.DE.S1.W0.LE.N._X.B")
bbk_series("BBBK11.D.TTA000")
Fetch Banco de España (BdE) data
Description
Retrieve time series data from the BdE statistics API.
Usage
bde_data(key, time_range = NULL, lang = "en")
Arguments
key |
( |
time_range |
(
If |
lang |
( |
Details
You can search for the series codes in the BIEST application or in the tables published by the Banco de España.
Value
A data.table::data.table()
with the requested data.
Source
https://www.bde.es/webbe/en/estadisticas/recursos/api-estadisticas-bde.html
See Also
Other data:
bbk_data()
,
bbk_series()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
bde_data("D_1NBAF472", time_range = "30M")
bde_data(c("DTNPDE2010_P0000P_PS_APU", "DTNSEC2010_S0000P_APU_SUMAMOVIL"), time_range = "MAX")
bde_data("DEEQ.N.ES.W1.S1.S1.T.B.G._Z._Z._Z.EUR._T._X.N.ALL", time_range = 2024)
Fetch Banque de France (BdF) codelists
Description
Fetch Banque de France (BdF) codelists
Usage
bdf_codelist(...)
Arguments
... |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://webstat.banque-france.fr/en/pages/guide-migration-api/
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
## Not run:
bdf_codelist()
# filter for a specific codelist
bdf_codelist(where = "codelist_id = 'CL_FREQ'")
## End(Not run)
Fetch Banque de France (BdF) data
Description
Retrieve time series data from the BdF Webstat API.
Usage
bdf_data(
...,
key = NULL,
start_date = NULL,
end_date = NULL,
api_key = bdf_key()
)
Arguments
... |
( |
key |
( |
start_date |
( |
end_date |
( |
api_key |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://webstat.banque-france.fr/en/pages/guide-migration-api/
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
## Not run:
bdf_data(key = "CONJ2.M.R24.T.SM.0RG24.EFTPM100.10")
# inflation rate
bdf_data(key = "ICP.M.FR.N.000000.4.ANR")
# or with a date filter
bdf_data(key = "ICP.M.FR.N.000000.4.ANR", start_date = "2025-01-01", end_date = "2025-06-30")
# advanced filter with where clause
bdf_data(key = "ICP.M.FR.N.000000.4.ANR", where = "time_period_start >= date'2025-01-01'")
## End(Not run)
Fetch Banque de France (BdF) datasets
Description
Fetch Banque de France (BdF) datasets
Usage
bdf_dataset(...)
Arguments
... |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://webstat.banque-france.fr/en/pages/guide-migration-api/
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
## Not run:
bdf_dataset()
# structure of a dataset
bdf_dataset(where = "dataset_id = 'CONJ2'")
## End(Not run)
Fetch Bank of Canada (BoC) available series or group
Description
Access all available series or groups from the Bank of Canada Valet API.
Usage
boc_catalog(type = "groups")
Arguments
type |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://www.bankofcanada.ca/valet/docs
Examples
## Not run:
catalog <- boc_catalog()
head(catalog)
# filter for effective exchange rate series
dt <- catalog[grepl("CEER", label)]
head(dt)
## End(Not run)
Fetch Bank of Canada (BoC) data
Description
Retrieve time series data from the Bank of Canada Valet API.
Usage
boc_data(
group_name = NULL,
series_name = NULL,
start_date = NULL,
end_date = NULL
)
Arguments
group_name |
( |
series_name |
( |
start_date |
( |
end_date |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://www.bankofcanada.ca/valet/docs
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boe_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
## Not run:
# fetch all data for a single group
dt <- boc_data(group_name = "FX_RATES_DAILY")
head(dt)
# or for multiple series ids
dt <- boc_data(
series_name = c("FXUSDCAD", "FXEURCAD"),
start_date = "2023-01-23",
end_date = "2023-07-19"
)
head(dt)
## End(Not run)
Fetch Bank of Canada foreign exchange rates
Description
Fetch the latest or historical foreign exchange reference rates from the Bank of Canada (BoC).
Usage
boc_fx_rates(start_date = NULL, end_date = NULL, limit = NULL, skip = NULL)
Arguments
start_date |
( |
end_date |
( |
limit |
( |
skip |
( |
Details
The recorded rates indicate the number of Canadian dollars required to buy a single unit of the foreign currency. New rates are released by the Bank of Canada (BoC) daily at 4:30 pm. The Canada Border Services (CBSA) retrieves these updates between 4:30 pm and 5 pm ET.
BoC provides 23 foreign exchange rates. All other rates are maintained by the CBSA.
Exchange rates from the BoC are updated daily in the system while other exchange rates are updated by the CBSA at set intervals. The updated rates are available for retrieval between 7 pm and 11:59 pm ET.
As BoC publishes exchange rates every business day, it is recommended that exchange rate data be retrieved on a daily basis. This retrieval should occur after 7 pm ET to ensure retrieval of the latest updates.
Value
A data.table::data.table()
with the exchange rates.
Source
https://www.cbsa-asfc.gc.ca/eservices/api/er-tc-api-eng.html
Examples
# fetch latest exchange rates
boc_fx_rates()
# fetch historical exchange rates
boc_fx_rates(start_date = "2021-10-22", end_date = "2021-10-23", limit = 10, skip = 2)
Fetch Bank of Canada (BoC) metadata (details)
Description
Fetch Bank of Canada (BoC) metadata (details)
Usage
boc_metadata(group_name = NULL, series_name = NULL)
Arguments
group_name |
( |
series_name |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://www.bankofcanada.ca/valet/docs
Examples
## Not run:
boc_metadata(group_name = "FX_RATES_DAILY")
boc_metadata(series_name = "FXUSDCAD")
## End(Not run)
Fetch Bank of England (BoE) data
Description
Retrieve time series data from the BoE database.
Usage
boe_data(key, start_date, end_date = Sys.Date())
Arguments
key |
( |
start_date |
( |
end_date |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://www.bankofengland.co.uk/boeapps/database
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
ecb_data()
,
onb_data()
,
snb_data()
Examples
boe_data(c("IUMABEDR", "IUALBEDR"), "2015-01-01")
Fetch European Central Bank (ECB) data
Description
Retrieve time series data from the ECB SDMX Web Service.
Usage
ecb_data(
flow,
key = NULL,
start_period = NULL,
end_period = NULL,
first_n = NULL,
last_n = NULL
)
Arguments
flow |
( |
key |
( |
start_period |
(
If |
end_period |
( |
first_n |
( |
last_n |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://data.ecb.europa.eu/help/api/data
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
onb_data()
,
snb_data()
Examples
# fetch US dollar/Euro exchange rate
ecb_data("EXR", "D.USD.EUR.SP00.A")
# fetch data for multiple keys
ecb_data("EXR", c("D.USD", "JPY.EUR.SP00.A"))
Fetch Euro foreign exchange reference rates
Description
Fetch the latest or historical Euro foreign exchange reference rates from the European Central Bank (ECB).
Usage
ecb_fx_rates(x = "latest")
ecb_euro_rates(x = "latest")
Arguments
x |
( |
Details
Note you can achieve the same by calling the ecb_data()
function with the right
parameters for each currency.
The reference rates are usually updated at around 16:00 CET every working day, except on TARGET closing days.
They are based on the daily concertation procedure between central banks across Europe, which normally takes place around 14:10 CET. The reference rates are published for information purposes only. Using the rates for transaction purposes is strongly discouraged.
Value
A data.table::data.table()
with the exchange rates.
Source
Examples
ecb_fx_rates()
Fetch European Central Bank (ECB) metadata
Description
Retrieve metadata from the ECB time series database via the SDMX Web Service.
Usage
ecb_metadata(type, agency = NULL, id = NULL)
Arguments
type |
( |
agency |
( |
id |
( |
Value
A data.table::data.table()
with the requested metadata.
The columns are:
agency |
The agency of the metadata |
id |
The id of the metadata |
name |
The name of the metadata |
Source
https://data.ecb.europa.eu/help/api/metadata
See Also
Other metadata:
bbk_metadata()
,
onb_dimension()
,
onb_frequency()
,
onb_hierarchy()
,
onb_metadata()
,
onb_toc()
Examples
ecb_metadata("datastructure")
ecb_metadata("datastructure", "ECB")
ecb_metadata("datastructure", "ECB", "ECB_EXR1")
ecb_metadata("datastructure", id = "ECB_EXR1")
Fetch Österreichische Nationalbank (OeNB) data
Description
Retrieve time series data from the OeNB Web Service.
Usage
onb_data(
hier_id,
key,
...,
start_period = NULL,
end_period = NULL,
freq = NULL,
lang = "en"
)
Arguments
hier_id |
( |
key |
( |
... |
( |
start_period |
( |
end_period |
( |
freq |
( |
lang |
( |
Value
A data.table::data.table()
with the requested data.
Source
https://www.oenb.at/en/Statistics/User-Defined-Tables/webservice.html
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
snb_data()
Examples
onb_data(hier_id = 11, key = "VDBFKBSC217000")
# Loans to euro area residents, since 2000:
onb_data(hier_id = 11, key = "VDBFKBSC217000", start_period = "2000-01-01")
# Austrian imports and exports of goods from/to Germany, 2002–2012, annual frequency:
onb_data(hier_id = 901, key = "VDBQZA1000", start_period = 2002, end_period = 2012, freq = "A")
# Number of Austrian banks' subsidiaries abroad an in the EU, from 2005, semiannual:
onb_data(
hier_id = 321,
key = c("VDBKISDANZTAU", "VDBKISDANZTEU"),
start_period = 200501,
freq = "H"
)
Fetch Österreichische Nationalbank (OeNB) dimension
Description
Fetch Österreichische Nationalbank (OeNB) dimension
Usage
onb_dimension(hier_id, key, lang = "en")
Arguments
hier_id |
( |
key |
( |
lang |
( |
Value
A data.table::data.table()
with the requested data.
See Also
Other metadata:
bbk_metadata()
,
ecb_metadata()
,
onb_frequency()
,
onb_hierarchy()
,
onb_metadata()
,
onb_toc()
Examples
onb_dimension(hier_id = 11, key = "VDBFKBSC217000")
Fetch Österreichische Nationalbank (OeNB) data frequency
Description
Fetch Österreichische Nationalbank (OeNB) data frequency
Usage
onb_frequency(hier_id, key, lang = "en", ...)
Arguments
hier_id |
( |
key |
( |
lang |
( |
... |
( |
Value
A data.table::data.table()
with the requested data.
See Also
Other metadata:
bbk_metadata()
,
ecb_metadata()
,
onb_dimension()
,
onb_hierarchy()
,
onb_metadata()
,
onb_toc()
Examples
onb_frequency(hier_id = 74, key = "VDBOSBHAGBSTIN")
onb_frequency(hier_id = 11, key = "VDBFKBSC217000")
Fetch Österreichische Nationalbank (OeNB) hierarchy
Description
Fetch Österreichische Nationalbank (OeNB) hierarchy
Usage
onb_hierarchy(hier_id, lang = "en")
Arguments
hier_id |
( |
lang |
( |
Value
A data.table::data.table()
with the requested data.
See Also
Other metadata:
bbk_metadata()
,
ecb_metadata()
,
onb_dimension()
,
onb_frequency()
,
onb_metadata()
,
onb_toc()
Examples
onb_hierarchy(hier_id = 11)
Fetch Österreichische Nationalbank (OeNB) metadata
Description
Fetch Österreichische Nationalbank (OeNB) metadata
Usage
onb_metadata(hier_id, key, ..., lang = "en")
Arguments
hier_id |
( |
key |
( |
... |
( |
lang |
( |
Value
A data.table::data.table()
with the requested data.
See Also
Other metadata:
bbk_metadata()
,
ecb_metadata()
,
onb_dimension()
,
onb_frequency()
,
onb_hierarchy()
,
onb_toc()
Examples
onb_metadata(hier_id = 11, key = "VDBFKBSC217000")
Fetch Österreichische Nationalbank (OeNB) table of contents
Description
Fetch Österreichische Nationalbank (OeNB) table of contents
Usage
onb_toc(lang = "en")
Arguments
lang |
( |
Value
A data.table::data.table()
with the requested data.
See Also
Other metadata:
bbk_metadata()
,
ecb_metadata()
,
onb_dimension()
,
onb_frequency()
,
onb_hierarchy()
,
onb_metadata()
Examples
onb_toc()
Fetch Swiss National Bank (SNB) data
Description
Retrieve time series data from the SNB data portal.
Usage
snb_data(key, start_date = NULL, end_date = NULL, lang = "en")
Arguments
key |
( |
start_date |
( |
end_date |
( |
lang |
( |
Value
A data.table::data.table()
with the requested data.
Source
See Also
Other data:
bbk_data()
,
bbk_series()
,
bde_data()
,
bdf_codelist()
,
bdf_data()
,
bdf_dataset()
,
boc_data()
,
boe_data()
,
ecb_data()
,
onb_data()
Examples
snb_data("rendopar")
# or filter for date range
snb_data("rendopar", "2020-01-01", "2020-12-31")