Retrieve time series data from the ECB SDMX Web Service.
ecb_data(
flow,
key = NULL,
start_period = NULL,
end_period = NULL,
first_n = NULL,
last_n = NULL,
updated_after = NULL
)A data.table::data.table() with the requested data.
(character(1))
Flow to query.
(NULL | character())
The series keys to query.
(NULL | character(1) | integer(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.
(NULL | character(1) | integer(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.
(NULL | numeric(1))
Number of observations to retrieve from the start of the series. If NULL, no restriction is
applied. Default NULL.
(NULL | numeric(1))
Number of observations to retrieve from the end of the series. If NULL, no restriction is
applied. Default NULL.
(NULL | character(1) | Date(1) | POSIXct(1))
Retrieve only observations updated after the given timestamp (e.g.,
"2024-06-01T00:00:00"). Useful for incremental retrieval. If NULL, no restriction is
applied. Default NULL.
Other data:
bbk_data(),
bbk_series(),
bde_data(),
bde_latest(),
bdf_codelist(),
bdf_data(),
bdf_dataset(),
bdp_data(),
bis_data(),
boc_data(),
boe_data(),
boj_data(),
cnb_czeonia(),
cnb_data(),
cnb_fx_other_rates(),
cnb_fx_rates(),
cnb_pribor(),
nbp_fx_rates(),
nbp_gold(),
nob_data(),
onb_data(),
snb_data(),
srb_cross_rates(),
srb_data()
# \donttest{
# 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"))
# }
Run the code above in your browser using DataLab