Title: Client for Central Bank APIs
Version: 0.7.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), and the 'Banque de France Web Service' (https://webstat.banque-france.fr/en/pages/guide-migration-api/).
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.2
NeedsCompilation: no
Packaged: 2025-08-25 08:29:22 UTC; mmuecke
Author: Maximilian Mücke ORCID iD [aut, cre]
Maintainer: Maximilian Mücke <muecke.maximilian@gmail.com>
Repository: CRAN
Date/Publication: 2025-08-25 08:40:13 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), and the 'Banque de France Web Service' (https://webstat.banque-france.fr/en/pages/guide-migration-api/).

Author(s)

Maintainer: Maximilian Mücke muecke.maximilian@gmail.com (ORCID)

See Also

Useful links:


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

(character(1))
The flow to query, 5-8 characters. See bbk_metadata() for available dataflows.

key

(character())
The series keys to query.

start_period

(NULL | character(1) | integer(1))
The start date of the data. Supported formats:

  • YYYY for annual data (e.g., '2019“)

  • YYYY-S[1-2] for semi-annual data (e.g., "2019-S1")

  • YYYY-Q[1-4] for quarterly data (e.g., "2019-Q1")

  • YYYY-MM for monthly data (e.g., "2019-01")

  • YYYY-W[01-53] for weekly data (e.g., "2019-W01")

  • YYYY-MM-DD for daily and business data (e.g., "2019-01-01")

If NULL, no start date restriction is applied (data retrieved from the earliest available date). Default NULL.

end_period

(NULL | character(1) | integer(1))
The end date of the data, in the same format as start_period. If NULL, no end date restriction is applied (data retrieved up to the most recent available date). Default NULL.

first_n

(NULL | numeric(1))
Number of observations to retrieve from the start of the series. If NULL, no restriction is applied. Default NULL.

last_n

(NULL | numeric(1))
Number of observations to retrieve from the end of the series. If NULL, no restriction is applied. Default NULL.

Value

A data.table::data.table() with the requested data.

Source

https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-data

See Also

Other data: bbk_series(), bde_data(), bdf_codelist(), bdf_data(), bdf_dataset(), boe_data(), ecb_data(), onb_data(), snb_data()

Examples



# fetch all data for a given flow and key
bbk_data("BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A")
# fetch data for multiple keys
bbk_data("BBEX3", c("M.ISK.EUR", "USD.CA.AC.A01"))
# specified period (start date-end date) for daily 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"
)
# or only specify the start date
bbk_data(
  "BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A",
  start_period = "2024-04-01"
)



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

(character(1))
The type of metadata to query. One of: "datastructure", "dataflow", "codelist", or "concept".

id

(NULL | character(1))
The id to query. Default NULL.

lang

(character(1))
Language to query, either "en" or "de". Default "en".

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

https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-metadata

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

(character())
The series keys to query.

Value

A data.table::data.table() with the requested data.

Source

https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-data

See Also

bbk_data() for an endpoint with more options.

Other data: bbk_data(), bde_data(), bdf_codelist(), bdf_data(), bdf_dataset(), 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

(character())
The series keys to query.

time_range

(NULL | character(1) | integer(1))
The time range for the data. Can be an annual range (e.g., 2024) or a frequency-based code:

  • Daily frequency (D): "3M" (last 3 months), "12M", "36M"

  • Monthly frequency (M): "30M", "60M", "MAX" (entire series)

  • Quarterly frequency (Q): "30M", "60M", "MAX"

  • Annual frequency (A): "60M", "MAX"

If NULL (default), returns the smallest range for the series frequency (e.g., "30M" for monthly series).

lang

(character(1))
Language to query, either "en" or "es".

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(), 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

...

(any)
Extra arguments appended to the API request. Combined with the default arguments with modifyList().

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(), 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

...

(any)
Extra arguments appended to the API request. Combined with the default arguments with modifyList().

key

(NULL | character(1))
The series key to query. Default NULL.

start_date

(NULL | character(1) | Date(1))
Start date of the data. Default NULL.

end_date

(NULL | character(1) | Date(1))
End date of the data. Default NULL.

api_key

(character(1))
API key to use for the request. Defaults to the value returned by bdf_key(), which reads from the BANQUEDEFRANCE_KEY environment variable.

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(), 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

...

(any)
Extra arguments appended to the API request. Combined with the default arguments with modifyList().

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(), 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 England (BoE) data

Description

Retrieve time series data from the BoE database.

Usage

boe_data(key, start_date, end_date = Sys.Date())

Arguments

key

(character())
The series keys to query.

start_date

(character(1) | Date(1))
Start date of the data.

end_date

(character(1) | Date(1))
End date of the data. Default is today's 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(), 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

(character(1))
Flow to query.

key

(character())
The series keys to query.

start_period

(NULL | character(1) | integer(1))
Start date of the data. Supported formats:

  • YYYY for annual data (e.g., 2019)

  • YYYY-S[1-2] for semi-annual data (e.g., "2019-S1")

  • YYYY-Q[1-4] for quarterly data (e.g., "2019-Q1")

  • YYYY-MM for monthly data (e.g., "2019-01")

  • YYYY-W[01-53] for weekly data (e.g., "2019-W01")

  • YYYY-MM-DD for daily and business data (e.g., "2019-01-01")

If NULL, no start date restriction is applied (data retrieved from the earliest available date). Default NULL.

end_period

(NULL | character(1) | integer(1))
End date of the data, in the same format as start_period. If NULL, no end date restriction is applied (data retrieved up to the most recent available date). Default NULL.

first_n

(NULL | numeric(1))
Number of observations to retrieve from the start of the series. If NULL, no restriction is applied. Default NULL.

last_n

(NULL | numeric(1))
Number of observations to retrieve from the end of the series. If NULL, no restriction is applied. Default NULL.

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(), 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_euro_rates(x = "latest")

Arguments

x

(character(1))
One of "latest" or "history". Default "latest".

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 reference rates.

Source

https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

Examples



ecb_euro_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

(character(1))
The type of metadata to query. One of: "datastructure", "dataflow", "codelist", or "concept".

agency

(NULL | character(1))
The id of the agency to query. Default NULL.

id

(NULL | character(1))
The id of the resource to query. Default NULL.

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

(integer(1))
Hierarchy id to query.

key

(character())
The series keys to query.

...

(any)
Additional parameters to pass to the API.

start_period

(NULL | character(1) | integer(1))
Start date of the data.

end_period

(NULL | character(1) | integer(1))
End date of the data.

freq

(NULL | character(1))
Frequency of the data.

lang

(character(1))
Language to query. Default "en".

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(), 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

(integer(1))
Hierarchy id to query.

key

(character())
The series keys to query.

lang

(character(1))
Language to query. Default "en".

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

(integer(1))
Hierarchy id to query.

key

(character())
The series keys to query.

lang

(character(1))
Language to query. Default "en".

...

(any)
Additional parameters to pass to the API.

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

(integer(1))
Hierarchy id to query.

lang

(character(1))
Language to query. Default "en".

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

(integer(1))
Hierarchy id to query.

key

(character())
The series keys to query.

...

(any)
Additional parameters to pass to the API.

lang

(character(1))
Language to query. Default "en".

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

(character(1))
Language to query. Default "en".

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

(character(1))
The series key to query.

start_date

(NULL | character(1) | Date(1))
Start date of the data.

end_date

(NULL | character(1) | Date(1))
End date of the data.

lang

(character(1))
Language to query, either "en" or "de". Default "en".

Value

A data.table::data.table() with the requested data.

Source

https://data.snb.ch/en

See Also

Other data: bbk_data(), bbk_series(), bde_data(), bdf_codelist(), bdf_data(), bdf_dataset(), boe_data(), ecb_data(), onb_data()

Examples



snb_data("rendopar")
# or filter for date range
snb_data("rendopar", "2020-01-01", "2020-12-31")