% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fetch-sidra-series.R
\name{fetch_sidra_rolling_quarters}
\alias{fetch_sidra_rolling_quarters}
\title{Fetch Rolling Quarter Series from SIDRA}
\usage{
fetch_sidra_rolling_quarters(
  series = "all",
  theme = NULL,
  theme_category = NULL,
  subcategory = NULL,
  exclude_derived = FALSE,
  use_cache = FALSE,
  verbose = TRUE,
  retry_failed = TRUE,
  max_retries = 3
)
}
\arguments{
\item{series}{Character vector of series names to fetch, or "all" (default)
for all available series. Use \code{get_sidra_series_metadata()$series_name}
to see available names.}

\item{theme}{Character vector of themes to filter by. Valid options:
"labor_market", "earnings", "demographics", "social_protection", "prices".
Use NULL for no filter.}

\item{theme_category}{Character vector of theme categories to filter by.
Use NULL for no filter.}

\item{subcategory}{Character vector of subcategories to filter by.
Use NULL for no filter.}

\item{exclude_derived}{Logical. If TRUE, exclude series marked as derived
(is_derived = TRUE in metadata). Default FALSE for backward compatibility.
Derived series (rates) are computed from other series during mensalization,
so excluding them saves API calls when fetching for mensalization.}

\item{use_cache}{Logical. Use cached data if available? Default FALSE.
When TRUE, shows the date when data was cached (may be outdated).
Use \code{\link{clear_sidra_cache}} to force fresh download.}

\item{verbose}{Logical. Print progress messages? Default TRUE.}

\item{retry_failed}{Logical. Retry failed series downloads? Default TRUE.}

\item{max_retries}{Integer. Maximum retry attempts per series. Default 3.}
}
\value{
A data.table with columns:
\describe{
\item{anomesfinaltrimmovel}{Integer. YYYYMM of rolling quarter end month}
\item{mesnotrim}{Integer. Month position in quarter (1, 2, or 3)}
\item{<series_name>}{Numeric. One column per requested series}
}
}
\description{
Downloads PNADC labor market indicators from IBGE's SIDRA API. These series
are published as rolling quarterly averages (trimestre movel), with 12
observations per year.
}
\details{
Rolling quarters are labeled by their ending month:
\itemize{
\item 201201 = Nov 2011 - Jan 2012 (mesnotrim = 1)
\item 201202 = Dec 2011 - Feb 2012 (mesnotrim = 2)
\item 201203 = Jan - Mar 2012 (mesnotrim = 3)
\item 201204 = Feb - Apr 2012 (mesnotrim = 1)
\item etc.
}

The \code{mesnotrim} column indicates the month's position within its rolling
quarter, which is essential for the mensalization algorithm.
}
\section{Rate Limiting}{

SIDRA API may have rate limits. The function includes automatic retry logic
with exponential backoff for failed requests.
}

\examples{
\donttest{
rq <- fetch_sidra_rolling_quarters(
  series = c("taxadesocup", "popocup", "popdesocup")
)
head(rq)
}

\donttest{
rq_labor <- fetch_sidra_rolling_quarters(theme = "labor_market")
}

}
\seealso{
\code{\link{get_sidra_series_metadata}} for available series names and metadata
\code{\link{mensalize_sidra_series}} to convert to exact months
}
