download_data_wrds_compustat: Download Data from WRDS Compustat

View source: R/download_data_wrds_compustat.R

download_data_wrds_compustatR Documentation

Download Data from WRDS Compustat

Description

Downloads financial data from the WRDS Compustat database for a given dataset, start date, and end date. It filters the data according to industry format, data format, and consolidation level, and returns the most current data for each reporting period. Additionally, the annual data also includes the calculated book equity (be), operating profitability (op), and investment (inv) for each company following Fama & French (1993, 2015), as well as income before extraordinary items (ib).

Usage

download_data_wrds_compustat(
  dataset = NULL,
  start_date = NULL,
  end_date = NULL,
  type = deprecated(),
  additional_columns = NULL,
  only_usd = FALSE,
  only_us = deprecated()
)

Arguments

dataset

The dataset to download ("compustat_annual" or "compustat_quarterly").

start_date

Optional. A character string or Date object in "YYYY-MM-DD" format specifying the start date for the data. If not provided, a subset of the dataset is returned.

end_date

Optional. A character string or Date object in "YYYY-MM-DD" format specifying the end date for the data. If not provided, a subset of the dataset is returned.

type

[Deprecated] Use dataset instead.

additional_columns

Additional columns from the Compustat table as a character vector.

only_usd

A logical indicating whether only USD-denominated shares should be returned.

only_us

[Deprecated] Use only_usd instead.

Value

A data frame with financial data for the specified period, including variables for book equity (be), operating profitability (op), investment (inv), and others.

References

Fama, E. F., & French, K. R. (1993). Common risk factors in the returns on stocks and bonds. Journal of Financial Economics, 33(1), 3-56. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0304-405X(93)90023-5")}

Fama, E. F., & French, K. R. (2015). A five-factor asset pricing model. Journal of Financial Economics, 116(1), 1-22. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jfineco.2014.10.010")}

See Also

Other WRDS functions: disconnect_connection(), download_data_wrds(), download_data_wrds_ccm_links(), download_data_wrds_crsp(), download_data_wrds_fisd(), download_data_wrds_trace_enhanced(), get_wrds_connection(), set_wrds_credentials()

Examples

## Not run: 
download_data_wrds_compustat("compustat_annual", "2020-01-01", "2020-12-31")
download_data_wrds_compustat(
  "compustat_quarterly",
  "2020-01-01",
  "2020-12-31"
)

  # Add additional columns
download_data_wrds_compustat(
  "compustat_annual",
  additional_columns = c("aodo", "aldo")
)

## End(Not run)

tidyfinance documentation built on July 3, 2026, 1:09 a.m.