Returns ECB data for a given flow and key
Usage
ecb_data(
flow,
key = NULL,
start_period = NULL,
end_period = NULL,
first_n = NULL,
last_n = NULL
)
Arguments
- flow
character(1)
flow to query.- 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). DefaultNULL
.
- end_period
character(1)
end date of the data, in the same format as start_period. IfNULL
, no end date restriction is applied (data retrieved up to the most recent available date). DefaultNULL
.- first_n
numeric(1)
number of observations to retrieve from the start of the series. IfNULL
, no restriction is applied. DefaultNULL
.- last_n
numeric(1)
number of observations to retrieve from the end of the series. IfNULL
, no restriction is applied. DefaultNULL
.
See also
Other data:
bbk_data()
,
bbk_series()
Examples
# \donttest{
# fetch US dollar/Euro exchange rate
ecb_data("EXR", "D.USD.EUR.SP00.A")
#> # A tibble: 6,686 × 16
#> date key value title description freq currency currency_denom
#> <date> <chr> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 1999-01-04 D.USD.EUR.S… 1.18 US d… ECB refere… daily USD EUR
#> 2 1999-01-05 D.USD.EUR.S… 1.18 US d… ECB refere… daily USD EUR
#> 3 1999-01-06 D.USD.EUR.S… 1.17 US d… ECB refere… daily USD EUR
#> 4 1999-01-07 D.USD.EUR.S… 1.16 US d… ECB refere… daily USD EUR
#> 5 1999-01-08 D.USD.EUR.S… 1.17 US d… ECB refere… daily USD EUR
#> 6 1999-01-11 D.USD.EUR.S… 1.16 US d… ECB refere… daily USD EUR
#> 7 1999-01-12 D.USD.EUR.S… 1.15 US d… ECB refere… daily USD EUR
#> 8 1999-01-13 D.USD.EUR.S… 1.17 US d… ECB refere… daily USD EUR
#> 9 1999-01-14 D.USD.EUR.S… 1.17 US d… ECB refere… daily USD EUR
#> 10 1999-01-15 D.USD.EUR.S… 1.16 US d… ECB refere… daily USD EUR
#> # ℹ 6,676 more rows
#> # ℹ 8 more variables: exr_type <chr>, exr_suffix <chr>, time_format <chr>,
#> # decimals <chr>, unit_mult <chr>, collection <chr>, source_agency <chr>,
#> # unit <chr>
# fetch data for multiple keys
ecb_data("EXR", c("D.USD", "JPY.EUR.SP00.A"))
#> # A tibble: 13,372 × 16
#> date key value title description freq currency currency_denom
#> <date> <chr> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 1999-01-04 D.JPY.EUR.S… 134. Japa… ECB refere… daily JPY EUR
#> 2 1999-01-05 D.JPY.EUR.S… 131. Japa… ECB refere… daily JPY EUR
#> 3 1999-01-06 D.JPY.EUR.S… 131. Japa… ECB refere… daily JPY EUR
#> 4 1999-01-07 D.JPY.EUR.S… 129. Japa… ECB refere… daily JPY EUR
#> 5 1999-01-08 D.JPY.EUR.S… 130. Japa… ECB refere… daily JPY EUR
#> 6 1999-01-11 D.JPY.EUR.S… 126. Japa… ECB refere… daily JPY EUR
#> 7 1999-01-12 D.JPY.EUR.S… 130. Japa… ECB refere… daily JPY EUR
#> 8 1999-01-13 D.JPY.EUR.S… 132. Japa… ECB refere… daily JPY EUR
#> 9 1999-01-14 D.JPY.EUR.S… 133. Japa… ECB refere… daily JPY EUR
#> 10 1999-01-15 D.JPY.EUR.S… 132. Japa… ECB refere… daily JPY EUR
#> # ℹ 13,362 more rows
#> # ℹ 8 more variables: exr_type <chr>, exr_suffix <chr>, unit_mult <chr>,
#> # decimals <chr>, source_agency <chr>, unit <chr>, time_format <chr>,
#> # collection <chr>
# }