Learn R Programming

tidyfinance (version 0.4.3)

download_data: Download and Process Data Based on Type

Description

Downloads and processes data based on the specified type (e.g., Fama-French factors, Global Q factors, or macro predictors), and date range. This function checks if the specified type is supported and then delegates to the appropriate function for downloading and processing the data.

Usage

download_data(type, start_date = NULL, end_date = NULL, ...)

Value

A tibble with processed data, including dates and the relevant financial metrics, filtered by the specified date range.

Arguments

type

The type of dataset to download, indicating either factor data or macroeconomic predictors.

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, dependening on the dataset type.

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.

...

Additional arguments passed to specific download functions depending on the type. For instance, if type is "constituents", this might include parameters specific to download_data_constituents.

Examples

Run this code
# \donttest{
  download_data("factors_ff_3_monthly", "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"))
# }

Run the code above in your browser using DataLab