% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/download_data.R
\name{download_data}
\alias{download_data}
\title{Download and Process Data Based on Domain and Dataset}
\usage{
download_data(
  domain = NULL,
  dataset = NULL,
  start_date = NULL,
  end_date = NULL,
  type = deprecated(),
  ...
)
}
\arguments{
\item{domain}{The domain of the dataset to download (e.g.,
"famafrench", "globalq", "macro_predictors", "wrds",
"constituents", "fred", "stock_prices", "osap", "tidyfinance").}

\item{dataset}{Optional. The specific dataset to download within the
domain.}

\item{start_date}{Optional. A character string or Date object in
"YYYY-MM-DD" format specifying the start date for the data. If not
provided, the full dataset or a subset is returned, depending on the
dataset type.}

\item{end_date}{Optional. A character string or Date object in
"YYYY-MM-DD" format specifying the end date for the data. If not
provided, the full dataset or a subset is returned, depending on the
dataset type.}

\item{type}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use \code{domain} and
\code{dataset} instead.}

\item{...}{Additional arguments passed to specific download functions
depending on the \code{domain}. For instance, if \code{domain} is
\code{"constituents"}, arguments are passed to
\code{download_data_constituents()}. If \code{domain} is \code{"tidyfinance"} and
\code{dataset} is \code{"factor_library"}, arguments are used to filter the
portfolio grid (e.g., \code{sorting_variable}, \code{rebalancing}, \code{fill_all});
see \code{download_data_huggingface()} for details.}
}
\value{
A tibble with processed data, including dates and the relevant
financial metrics, filtered by the specified date range.
}
\description{
Downloads and processes data based on the specified domain (e.g.,
Fama-French factors, Global Q factors, or macro predictors), dataset,
and date range. This function checks if the specified domain is supported
and then delegates to the appropriate function for downloading and
processing the data.
}
\examples{
\donttest{
download_data(
  "famafrench",
  "Fama/French 5 Factors (2x3) [Daily]",
  "2000-01-01",
  "2020-12-31"
)
download_data("macro_predictors", "monthly", "2000-01-01", "2020-12-31")
download_data("constituents", index = "DAX")
download_data("fred", series = c("GDP", "CPIAUCNS"))
download_data("stock_prices", symbols = c("AAPL", "MSFT"))
download_data(
  "tidyfinance",
  "risk_free",
  "2020-01-01",
  "2020-12-31"
)
download_data(
  "tidyfinance",
  "high_frequency_sp500",
  "2007-07-26",
  "2007-07-27"
)
download_data(
  "tidyfinance",
  "factor_library",
  sorting_variable = "52w",
  rebalancing = "annual"
)
}
}
\seealso{
Other download functions: 
\code{\link{download_data_constituents}()},
\code{\link{download_data_factors_ff}()},
\code{\link{download_data_factors_q}()},
\code{\link{download_data_fred}()},
\code{\link{download_data_huggingface}()},
\code{\link{download_data_macro_predictors}()},
\code{\link{download_data_osap}()},
\code{\link{download_data_risk_free}()},
\code{\link{download_data_stock_prices}()}
}
\concept{download functions}
