https://github.com/m-muecke/bbk
R client for central bank APIs
https://github.com/m-muecke/bbk
api bundesbank central-bank deutsche-bundesbank ecb european-central-bank r r-package smdx swiss-national-bank
Last synced: 2 months ago
JSON representation
R client for central bank APIs
- Host: GitHub
- URL: https://github.com/m-muecke/bbk
- Owner: m-muecke
- License: other
- Created: 2024-01-06T15:56:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-03T21:36:12.000Z (3 months ago)
- Last Synced: 2025-03-15T01:42:59.344Z (3 months ago)
- Topics: api, bundesbank, central-bank, deutsche-bundesbank, ecb, european-central-bank, r, r-package, smdx, swiss-national-bank
- Language: R
- Homepage: https://m-muecke.github.io/bbk/
- Size: 9.1 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(str = strOptions(strict.width = "cut"))
```# bbk
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/m-muecke/bbk/actions/workflows/R-CMD-check.yaml)
[](https://CRAN.R-project.org/package=bbk)bbk is minimal R client for the following APIs:
- [Deutsche Bundesbank (BBK)](https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service)
- [European Central Bank (ECB)](https://data.ecb.europa.eu/help/api/overview)
- [Swiss National Bank (SNB)](https://data.snb.ch/en)> 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](https://CRAN.R-project.org) with:
```{r, eval = FALSE}
install.packages("bbk")
```And the development version from [GitHub](https://github.com/) with:
```{r, eval = FALSE}
# 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](https://data.ecb.europa.eu/) or
[Bundesbank website](https://www.bundesbank.de/en/statistics/time-series-databases)
and then use it to retrieve the data.```{r demo, message = FALSE}
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"
)
str(yield_curve)
``````{r plotting, message = FALSE, echo = FALSE, dpi = 300}
library(ggplot2)ggplot(yield_curve, aes(x = date, y = value)) +
geom_line() +
theme_minimal() +
theme(
plot.title = element_text(face = "bold"),
panel.grid.major.y = element_line(color = "black", linewidth = 0.2),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(color = "black"),
axis.title = element_blank()
) +
scale_y_continuous(labels = scales::percent) +
labs(title = "Daily Yields of 10-Year Federal Securities")
```## Related work
* [SNBdata](https://github.com/enricoschumann/SNBdata): R package for downloading data from the Swiss National Bank (SNB).
* [bundesbank](https://github.com/enricoschumann/bundesbank): R scripts for downloading time-series data from the Bundesbank.
* [ecb](https://github.com/expersso/ecb): R interface to the European Central Bank's Statistical Data Warehouse (SDW) API.
* [pdfetch](https://github.com/abielr/pdfetch): R package for downloading economic and financial time series from public sources.
* [readsdmx](https://github.com/mdequeljoe/readsdmx): R package for reading SDMX data and metadata.
* [rsdmx](https://github.com/opensdmx/rsdmx): R package for reading SDMX data and metadata.