download_pseudo.download_data_pseudo_crsp()
Generate pseudo CRSP data with the WRDS CRSP schema.
Usage
download_pseudo.download_data_pseudo_crsp(
dataset=None,
start_date=None,
end_date=None,
version="v2",
additional_columns=None,
add_ccm_links=False,
adjust_volume=False,
batch_size=500,
n_assets=1000,
seed=1234
)Returns simulated panel data that mirrors the column layout of ‘download_data_wrds_crsp’. Useful for testing and for reproducing the workflow of CRSP-based analyses without a WRDS subscription. The generated values are random draws and are not suitable for inference. Both ‘crsp_monthly’ and ‘crsp_daily’ are supported; the daily panel uses weekdays (Monday through Friday) only so the calendar approximates a trading-day grid.
Parameters
dataset: str = None-
Which CRSP variant to simulate. One of ‘crsp_monthly’ or ‘crsp_daily’.
start_date: str or datetime - like = None-
Inclusive lower bound of the simulated panel, in ‘YYYY-MM-DD’ format. Falls back to a default range when omitted.
end_date: str or datetime - like = None-
Inclusive upper bound of the simulated panel, in ‘YYYY-MM-DD’ format.
version: str = "v2"-
Accepted for API compatibility with ‘download_data_wrds_crsp’; the pseudo schema follows the v2 output.
additional_columns: list of str = None-
Extra column names appended to the panel. Filled with plausible random draws so call sites continue to work; values themselves are not economically meaningful.
add_ccm_links: bool = False-
When ‘True’, a ‘gvkey’ column derived from the same pseudo identifier universe used by ‘download_data_pseudo_ccm_links’ is appended.
adjust_volume: bool = False-
Accepted for API compatibility; ignored for pseudo data.
batch_size: int = 500-
Accepted for API compatibility; ignored for pseudo data.
n_assets: int = 1000-
Number of pseudo firms in the universe.
seed: int = 1234- Random seed controlling the pseudo identifier universe and the simulated values. Identical ‘(seed, n_assets)’ pairs produce identical output across calls and match the identifier universe used by ‘download_data_pseudo_compustat’ and ‘download_data_pseudo_ccm_links’.
Returns
pl.DataFrame- For ‘crsp_monthly’, a DataFrame with columns ‘permno’, ‘date’, ‘calculation_date’, ‘ret’, ‘shrout’, ‘prc’, ‘primaryexch’, ‘siccd’, ‘listing_age’, ‘mktcap’, ‘mktcap_lag’, ‘prc_lag’, ‘exchange’, ‘industry’, and ‘ret_excess’. For ‘crsp_daily’, a DataFrame with columns ‘permno’, ‘date’, ‘ret’, and ‘ret_excess’. When ‘add_ccm_links=True’, a ‘gvkey’ column is appended.
Examples
from tidyfinance import download_data_pseudo_crsp
monthly = download_data_pseudo_crsp(
'crsp_monthly',
start_date='2020-01-01',
end_date='2024-12-31',
n_assets=20,
)
daily = download_data_pseudo_crsp(
'crsp_daily',
start_date='2020-01-01',
end_date='2020-03-31',
n_assets=20,
)