Skip to contents

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.

See also

Other data: bbk_series(), ecb_data()

Examples

# \donttest{
# 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")
#> # A tibble: 6,923 × 25
#>    date       key          value title freq  bearer_reg item  valuation currency
#>    <date>     <chr>        <dbl> <chr> <chr> <chr>      <chr> <chr>     <chr>   
#>  1 1997-08-07 BBSIS.D.I.Z…  5.76 Yiel… daily I          ZAR   ZI        EUR     
#>  2 1997-08-08 BBSIS.D.I.Z…  5.76 Yiel… daily I          ZAR   ZI        EUR     
#>  3 1997-08-11 BBSIS.D.I.Z…  5.75 Yiel… daily I          ZAR   ZI        EUR     
#>  4 1997-08-12 BBSIS.D.I.Z…  5.72 Yiel… daily I          ZAR   ZI        EUR     
#>  5 1997-08-13 BBSIS.D.I.Z…  5.77 Yiel… daily I          ZAR   ZI        EUR     
#>  6 1997-08-14 BBSIS.D.I.Z…  5.74 Yiel… daily I          ZAR   ZI        EUR     
#>  7 1997-08-15 BBSIS.D.I.Z…  5.72 Yiel… daily I          ZAR   ZI        EUR     
#>  8 1997-08-18 BBSIS.D.I.Z…  5.72 Yiel… daily I          ZAR   ZI        EUR     
#>  9 1997-08-19 BBSIS.D.I.Z…  5.66 Yiel… daily I          ZAR   ZI        EUR     
#> 10 1997-08-20 BBSIS.D.I.Z…  5.71 Yiel… daily I          ZAR   ZI        EUR     
#> # ℹ 6,913 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>
# fetch data for multiple keys
bbk_data("BBK01", c("TTA032", "TTA010"))
#> # A tibble: 5,184 × 10
#>    date       key   value title freq  dim1  time_format decimals unit  unit_mult
#>    <date>     <chr> <dbl> <chr> <chr> <chr> <chr>       <chr>    <chr> <chr>    
#>  1 1998-12-22 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  2 1999-01-01 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  3 1999-01-08 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  4 1999-01-15 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  5 1999-01-22 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  6 1999-01-29 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  7 1999-02-05 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  8 1999-02-12 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#>  9 1999-02-19 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#> 10 1999-02-26 BBK0…     0 Clai… daily TTA0… P1D         0        EURO  6        
#> # ℹ 5,174 more rows
# 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"
)
#> # A tibble: 148 × 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.Z… -0.16 Yiel… daily I          ZAR   ZI        EUR     
#>  2 2020-01-03 BBSIS.D.I.Z… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#>  3 2020-01-06 BBSIS.D.I.Z… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#>  4 2020-01-07 BBSIS.D.I.Z… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#>  5 2020-01-08 BBSIS.D.I.Z… -0.27 Yiel… daily I          ZAR   ZI        EUR     
#>  6 2020-01-09 BBSIS.D.I.Z… -0.22 Yiel… daily I          ZAR   ZI        EUR     
#>  7 2020-01-10 BBSIS.D.I.Z… -0.2  Yiel… daily I          ZAR   ZI        EUR     
#>  8 2020-01-13 BBSIS.D.I.Z… -0.19 Yiel… daily I          ZAR   ZI        EUR     
#>  9 2020-01-14 BBSIS.D.I.Z… -0.17 Yiel… daily I          ZAR   ZI        EUR     
#> 10 2020-01-15 BBSIS.D.I.Z… -0.22 Yiel… daily I          ZAR   ZI        EUR     
#> # ℹ 138 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>
# 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"
)
#> # A tibble: 159 × 25
#>    date       key          value title freq  bearer_reg item  valuation currency
#>    <date>     <chr>        <dbl> <chr> <chr> <chr>      <chr> <chr>     <chr>   
#>  1 2024-04-02 BBSIS.D.I.Z…  2.37 Yiel… daily I          ZAR   ZI        EUR     
#>  2 2024-04-03 BBSIS.D.I.Z…  2.41 Yiel… daily I          ZAR   ZI        EUR     
#>  3 2024-04-04 BBSIS.D.I.Z…  2.39 Yiel… daily I          ZAR   ZI        EUR     
#>  4 2024-04-05 BBSIS.D.I.Z…  2.37 Yiel… daily I          ZAR   ZI        EUR     
#>  5 2024-04-08 BBSIS.D.I.Z…  2.46 Yiel… daily I          ZAR   ZI        EUR     
#>  6 2024-04-09 BBSIS.D.I.Z…  2.42 Yiel… daily I          ZAR   ZI        EUR     
#>  7 2024-04-10 BBSIS.D.I.Z…  2.37 Yiel… daily I          ZAR   ZI        EUR     
#>  8 2024-04-11 BBSIS.D.I.Z…  2.48 Yiel… daily I          ZAR   ZI        EUR     
#>  9 2024-04-12 BBSIS.D.I.Z…  2.4  Yiel… daily I          ZAR   ZI        EUR     
#> 10 2024-04-15 BBSIS.D.I.Z…  2.41 Yiel… daily I          ZAR   ZI        EUR     
#> # ℹ 149 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>
# }