download_data_pseudo_crsp: Generate Pseudo CRSP Data

View source: R/download_data_pseudo_crsp.R

download_data_pseudo_crspR Documentation

Generate Pseudo CRSP Data

Description

Returns pseudo CRSP data with the same column layout as download_data_wrds_crsp(). Useful for testing and for reproducing the workflow of analyses that rely on CRSP without a WRDS subscription. The returned values are simulated and not suitable for inference.

Usage

download_data_pseudo_crsp(
  dataset = NULL,
  start_date = NULL,
  end_date = NULL,
  version = "v2",
  additional_columns = NULL,
  add_ccm_links = FALSE,
  adjust_volume = FALSE,
  batch_size = 500,
  n_assets = 1000L,
  seed = 1234L
)

Arguments

dataset

A string specifying the dataset to simulate. Supported: "crsp_monthly" and "crsp_daily".

start_date

Optional. A character string or Date object in "YYYY-MM-DD" format specifying the start date for the pseudo panel.

end_date

Optional. A character string or Date object in "YYYY-MM-DD" format specifying the end date for the pseudo panel.

version

Accepted for API compatibility with download_data_wrds_crsp(); the pseudo schema follows the v2 output.

additional_columns

Additional CRSP columns to include. Filled with plausible random draws so call sites that pass additional_columns continue to work; the values themselves are not economically meaningful.

add_ccm_links

A logical indicating whether CRSP-Compustat links should be appended. When TRUE, the output gains a gvkey column whose values are derived from the same pseudo identifier universe used by download_data_pseudo_ccm_links().

adjust_volume

Accepted for API compatibility with download_data_wrds_crsp(); ignored for pseudo data.

batch_size

Accepted for API compatibility with download_data_wrds_crsp(); ignored for pseudo data.

n_assets

Integer. Number of pseudo firms in the universe. Defaults to 1000.

seed

Integer. Random seed; defaults to 1234. Identical ⁠(seed, n_assets)⁠ produces identical output across calls and matches the identifier universe used by download_data_pseudo_compustat() and download_data_pseudo_ccm_links().

Details

Both "crsp_monthly" and "crsp_daily" are supported. The daily panel uses weekdays (Monday-Friday) only; weekend dates are excluded so the pseudo calendar approximates a trading-day grid.

Value

For "crsp_monthly", a tibble with columns permno, date, calculation_date, ret, shrout, prc, primaryexch, siccd, listing_age, mktcap, mktcap_lag, exchange, industry, and ret_excess. For "crsp_daily", a tibble with columns permno, date, ret, and ret_excess. If add_ccm_links = TRUE, a gvkey column is appended.

See Also

Other pseudo functions: download_data_pseudo_ccm_links(), download_data_pseudo_compustat()

Examples

download_data_pseudo_crsp(
  "crsp_monthly",
  start_date = "2020-01-01",
  end_date = "2024-12-31",
  n_assets = 20
)
download_data_pseudo_crsp(
  "crsp_daily",
  start_date = "2020-01-01",
  end_date = "2020-03-31",
  n_assets = 20
)

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