Learn R Programming

bbk (version 0.11.0)

bdp_data: Fetch Banco de Portugal (BdP) data

Description

Retrieve time series data from the BPstat API.

Usage

bdp_data(
  domain_id,
  dataset_id,
  series_ids = NULL,
  start_date = NULL,
  end_date = NULL,
  last_n = NULL,
  updated_after = NULL,
  lang = "en"
)

Value

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

Arguments

domain_id

(integer(1))
The domain ID. Use bdp_domain() to list available domains.

dataset_id

(character(1))
The dataset ID within the domain.

series_ids

(NULL | integer())
Optional series IDs to filter the dataset.

start_date

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

end_date

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

last_n

(NULL | integer(1))
Return only the last n observations per series.

updated_after

(NULL | character(1) | Date(1) | POSIXct(1))
Retrieve only observations published after the given timestamp (e.g., "2024-06-01T00:00:00"). Useful for incremental retrieval. If NULL, no restriction is applied. Default NULL.

lang

(character(1))
Language for labels, either "en" or "pt".

Details

The BPstat API uses a two-step workflow: first look up the series metadata with bdp_series() to find the domain_id and dataset_id, then use those to fetch the actual observations.

You can browse available series at the BPstat portal.

See Also

Other data: bbk_data(), bbk_series(), bde_data(), bde_latest(), bdf_codelist(), bdf_data(), bdf_dataset(), bis_data(), boc_data(), boe_data(), boj_data(), cnb_czeonia(), cnb_data(), cnb_fx_other_rates(), cnb_fx_rates(), cnb_pribor(), ecb_data(), nbp_fx_rates(), nbp_gold(), nob_data(), onb_data(), snb_data(), srb_cross_rates(), srb_data()

Examples

Run this code
# \donttest{
# Portuguese GDP (annual, current prices)
bdp_data(54L, "ce3e4e50cda325537eff729ef64037cd", series_ids = 12518356L)
# }

Run the code above in your browser using DataLab