bbk

Lifecycle: experimental R-CMD-check CRAN status

bbk is minimal R client for the Deutsche Bundesbank and the European Central Bank (ECB) APIs.

In the future, it may be extended to other central banks and financial institutions. Feel free to open an issue if you have a specific request.

Installation

You can install the released version of bbk from CRAN with:

install.packages("bbk")

And the development version from GitHub with:

# install.packages("pak")
pak::pak("m-muecke/bbk")

Usage

bbk functions are prefixed with either bbk_ or ecb_ depending on the origin of the data and follow the naming convention of the APIs. The usual workflow would be to search for the time series key on the ECB Portal or Bundesbank website and then use it to retrieve the data.

library(bbk)

# fetch 10 year daily yield curve
yield_curve <- bbk_data(
  flow = "BBSIS",
  key = "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A",
  start_period = "2020-01-01"
)
yield_curve
#> # A tibble: 1,152 × 25
#>   date       key           value title freq  bearer_reg item  valuation currency
#>   <date>     <chr>         <dbl> <chr> <chr> <chr>      <chr> <chr>     <chr>   
#> 1 2020-01-02 BBSIS.D.I.ZA… -0.16 Yiel… daily I          ZAR   ZI        EUR     
#> 2 2020-01-03 BBSIS.D.I.ZA… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#> 3 2020-01-06 BBSIS.D.I.ZA… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#> 4 2020-01-07 BBSIS.D.I.ZA… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#> 5 2020-01-08 BBSIS.D.I.ZA… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#> # ℹ 1,147 more rows
#> # ℹ 16 more variables: issuer_class <chr>, listed_sub <chr>,
#> #   security_class <chr>, maturity <chr>, interest_type <chr>,
#> #   interest_rate <chr>, redemption <chr>, certificate <chr>, coverage <chr>,
#> #   rating <chr>, time_format <chr>, decimals <chr>, unit <chr>,
#> #   unit_mult <chr>, category <chr>, unit_eng <chr>