% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bbk.R
\name{bbk_data}
\alias{bbk_data}
\title{Fetch Deutsche Bundesbank (BBk) data}
\source{
\url{https://www.bundesbank.de/en/statistics/time-series-databases/help-for-sdmx-web-service/web-service-interface-data}
}
\usage{
bbk_data(
  flow,
  key = NULL,
  start_period = NULL,
  end_period = NULL,
  first_n = NULL,
  last_n = NULL,
  updated_after = NULL
)
}
\arguments{
\item{flow}{(\code{character(1)})\cr
The flow to query, 5-8 characters. See \code{\link[=bbk_metadata]{bbk_metadata()}} for available dataflows.}

\item{key}{(\code{NULL} | \code{character()})\cr
The series keys to query.}

\item{start_period}{(\code{NULL} | \code{character(1)} | \code{integer(1)})\cr
The start date of the data. Supported formats:
\itemize{
\item YYYY for annual data (e.g., `2019``)
\item YYYY-S[1-2] for semi-annual data (e.g., \code{"2019-S1"})
\item YYYY-Q[1-4] for quarterly data (e.g., \code{"2019-Q1"})
\item YYYY-MM for monthly data (e.g., \code{"2019-01"})
\item YYYY-W[01-53] for weekly data (e.g., \code{"2019-W01"})
\item YYYY-MM-DD for daily and business data (e.g., \code{"2019-01-01"})
}

If \code{NULL}, no start date restriction is applied (data retrieved from the earliest available
date). Default \code{NULL}.}

\item{end_period}{(\code{NULL} | \code{character(1)} | \code{integer(1)})\cr
The end date of the data, in the same format as start_period. If \code{NULL}, no end date
restriction is applied (data retrieved up to the most recent available date). Default \code{NULL}.}

\item{first_n}{(\code{NULL} | \code{numeric(1)})\cr
Number of observations to retrieve from the start of the series. If \code{NULL}, no restriction is
applied. Default \code{NULL}.}

\item{last_n}{(\code{NULL} | \code{numeric(1)})\cr
Number of observations to retrieve from the end of the series. If \code{NULL}, no restriction is
applied. Default \code{NULL}.}

\item{updated_after}{(\code{NULL} | \code{character(1)} | \code{Date(1)} | \code{POSIXct(1)})\cr
Retrieve only observations updated after the given timestamp (e.g.,
\code{"2024-06-01T00:00:00"}). Useful for incremental retrieval. If \code{NULL}, no restriction is
applied. Default \code{NULL}.}
}
\value{
A \code{\link[data.table:data.table]{data.table::data.table()}} with the requested data.
}
\description{
Retrieve time series data from the Bundesbank SDMX Web Service.
}
\examples{
\dontshow{if (curl::has_internet()) withAutoprint(\{ # examplesIf}
\donttest{
# fetch all data for a given flow and key
data <- bbk_data("BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A")
head(data)

# fetch data for multiple keys
data <- bbk_data("BBEX3", c("M.ISK.EUR", "USD.CA.AC.A01"))
head(data)

# specified period (start date-end date) for daily data
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"
)
head(data)

# or only specify the start date
data <- bbk_data(
  "BBSIS", "D.I.ZAR.ZI.EUR.S1311.B.A604.R10XX.R.A.A._Z._Z.A",
  start_period = "2024-04-01"
)
head(data)
}
\dontshow{\}) # examplesIf}
}
\seealso{
Other data:
\code{\link[=bbk_series]{bbk_series()}},
\code{\link[=bde_data]{bde_data()}},
\code{\link[=bde_latest]{bde_latest()}},
\code{\link[=bdf_codelist]{bdf_codelist()}},
\code{\link[=bdf_data]{bdf_data()}},
\code{\link[=bdf_dataset]{bdf_dataset()}},
\code{\link[=bdp_data]{bdp_data()}},
\code{\link[=bis_data]{bis_data()}},
\code{\link[=boc_data]{boc_data()}},
\code{\link[=boe_data]{boe_data()}},
\code{\link[=boj_data]{boj_data()}},
\code{\link[=ecb_data]{ecb_data()}},
\code{\link[=nbp_fx_rates]{nbp_fx_rates()}},
\code{\link[=nbp_gold]{nbp_gold()}},
\code{\link[=nob_data]{nob_data()}},
\code{\link[=onb_data]{onb_data()}},
\code{\link[=snb_data]{snb_data()}},
\code{\link[=srb_cross_rates]{srb_cross_rates()}},
\code{\link[=srb_data]{srb_data()}}
}
\concept{data}
