download_pseudo.download_data_pseudo_compustat()
Generate pseudo Compustat data with the WRDS schema.
Usage
download_pseudo.download_data_pseudo_compustat(
dataset=None,
start_date=None,
end_date=None,
additional_columns=None,
only_usd=False,
n_assets=1000,
seed=1234
)Returns simulated panel data that mirrors the column layout of ‘download_data_wrds_compustat’. Useful for testing and for reproducing the workflow of Compustat-based analyses without a WRDS subscription. The generated values are random draws and are not suitable for inference. Both ‘compustat_annual’ and ‘compustat_quarterly’ are supported.
Parameters
dataset: str = None-
Which Compustat variant to simulate. One of ‘compustat_annual’ or ‘compustat_quarterly’.
start_date: str or datetime - like = None-
Inclusive lower bound of the simulated panel, in ‘YYYY-MM-DD’ format.
end_date: str or datetime - like = None-
Inclusive upper bound of the simulated panel, in ‘YYYY-MM-DD’ format.
additional_columns: list of str = None-
Extra column names appended to the panel. Filled with plausible random draws; values themselves are not economically meaningful.
only_usd: bool = False-
Accepted for API compatibility with ‘download_data_wrds_compustat’. The pseudo universe is treated as USD-denominated, so this flag has no effect.
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_crsp’ and ‘download_data_pseudo_ccm_links’.
Returns
pl.DataFrame- For ‘compustat_annual’, a DataFrame with ‘gvkey’, ‘date’, ‘datadate’, the financial-statement variables ‘seq’, ‘ceq’, ‘at’, ‘lt’, ‘txditc’, ‘txdb’, ‘itcb’, ‘pstkrv’, ‘pstkl’, ‘pstk’, ‘capx’, ‘oancf’, ‘sale’, ‘cogs’, ‘xint’, ‘xsga’, ‘ib’, ‘curcd’, plus the derived ‘be’, ‘op’, ‘at_lag’, ‘inv’, and any requested ‘additional_columns’. For ‘compustat_quarterly’, a DataFrame with ‘gvkey’, ‘date’, ‘datadate’, ‘atq’, ‘ceqq’, and any requested ‘additional_columns’.
Examples
from tidyfinance import download_data_pseudo_compustat
annual = download_data_pseudo_compustat(
'compustat_annual',
start_date='2020-01-01',
end_date='2024-12-31',
n_assets=20,
)
quarterly = download_data_pseudo_compustat(
'compustat_quarterly',
start_date='2020-01-01',
end_date='2024-12-31',
n_assets=20,
)