% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bdp.R
\name{bdp_data}
\alias{bdp_data}
\title{Fetch Banco de Portugal (BdP) data}
\source{
\url{https://bpstat.bportugal.pt/data/docs}
}
\usage{
bdp_data(
  domain_id,
  dataset_id,
  series_ids = NULL,
  start_date = NULL,
  end_date = NULL,
  last_n = NULL,
  updated_after = NULL,
  lang = "en"
)
}
\arguments{
\item{domain_id}{(\code{integer(1)})\cr
The domain ID. Use \code{\link[=bdp_domain]{bdp_domain()}} to list available domains.}

\item{dataset_id}{(\code{character(1)})\cr
The dataset ID within the domain.}

\item{series_ids}{(\code{NULL} | \code{integer()})\cr
Optional series IDs to filter the dataset.}

\item{start_date}{(\code{NULL} | \code{character(1)} | \code{Date(1)})\cr
Start date of the data.}

\item{end_date}{(\code{NULL} | \code{character(1)} | \code{Date(1)})\cr
End date of the data.}

\item{last_n}{(\code{NULL} | \code{integer(1)})\cr
Return only the last \code{n} observations per series.}

\item{updated_after}{(\code{NULL} | \code{character(1)} | \code{Date(1)} | \code{POSIXct(1)})\cr
Retrieve only observations published 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}.}

\item{lang}{(\code{character(1)})\cr
Language for labels, either \code{"en"} or \code{"pt"}.}
}
\value{
A \code{\link[data.table:data.table]{data.table::data.table()}} with the requested data.
}
\description{
Retrieve time series data from the BPstat API.
}
\details{
The BPstat API uses a two-step workflow: first look up the series metadata with
\code{\link[=bdp_series]{bdp_series()}} to find the \code{domain_id} and \code{dataset_id}, then use those to fetch the actual
observations.

You can browse available series at the \href{https://bpstat.bportugal.pt}{BPstat portal}.
}
\examples{
\dontshow{if (curl::has_internet()) withAutoprint(\{ # examplesIf}
\donttest{
# Portuguese GDP (annual, current prices)
bdp_data(54L, "ce3e4e50cda325537eff729ef64037cd", series_ids = 12518356L)
}
\dontshow{\}) # examplesIf}
}
\seealso{
Other data:
\code{\link[=bbk_data]{bbk_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[=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}
