Package 'bbk'

Title: Client for the Deutsche Bundesbank and European Central Bank APIs
Description: Download data and metadata from the 'Bundesbank SDMX Web Service API' found at <https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-data> and the 'ECB Data Portal API' found at <https://data.ecb.europa.eu/help/api/overview>.
Authors: Maximilian Mücke [aut, cre]
Maintainer: Maximilian Mücke <[email protected]>
License: MIT + file LICENSE
Version: 0.4.0.9000
Built: 2024-11-11 21:15:19 UTC
Source: https://github.com/m-muecke/bbk

Help Index


Returns Bundesbank data for a given flow and key

Description

Returns Bundesbank data for a given flow and key

Usage

bbk_data(
  flow,
  key = NULL,
  start_period = NULL,
  end_period = NULL,
  first_n = NULL,
  last_n = NULL
)

Arguments

flow

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

key

character(1) key to query.

start_period

character(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

character(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

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

last_n

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

Value

A data.frame() 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(), ecb_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("BBK01", c("TTA032", "TTA010"))
# 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"
)

Returns the available Bundesbank metadata

Description

Retrieval of the metadata stored in the Bundesbank's time series database. Access via the SDMX Web Service API of the Bundesbank.

Usage

bbk_metadata(type, id = NULL, lang = c("en", "de"))

Arguments

type

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

id

character(1) id to query. Default NULL.

lang

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

Value

A data.frame() with the queried 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()

Examples

bbk_metadata("datastructure")
bbk_metadata("dataflow", "BBSIS")
bbk_metadata("codelist", "CL_BBK_ACIP_ASSET_LIABILITY")
bbk_metadata("concept", "CS_BBK_BSPL")

Returns the Bundesbank time serie that is found with the specified time series key

Description

Returns the Bundesbank time serie that is found with the specified time series key

Usage

bbk_series(key)

Arguments

key

character(1) key to query.

Value

A data.frame() 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(), ecb_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")

Returns ECB data for a given flow and key

Description

Returns ECB data for a given flow and key

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(1) key to query.

start_period

character(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

character(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

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

last_n

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

Source

https://data.ecb.europa.eu/help/api/data

See Also

Other data: bbk_data(), bbk_series()

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"))

Euro foreign exchange reference rates

Description

Fetch the latest or historical Euro foreign exchange reference rates from the European Central Bank.

Usage

ecb_euro_rates(x = c("latest", "history"))

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.frame() with the reference rates.

Source

http://www.ecb.europa.eu/stats/eurofxref/

Examples

ecb_euro_rates()

Returns the available ECB metadata

Description

Retrieval of the metadata stored in the ECB's time series database. Access via the SDMX Web Service API of the ECB

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

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

id

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

Value

A data.frame() with the queried 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()

Examples

ecb_metadata("datastructure")
ecb_metadata("datastructure", "ECB")
ecb_metadata("datastructure", "ECB", "ECB_EXR1")
ecb_metadata("datastructure", id = "ECB_EXR1")