quantlab.dataset.constituent.CrspMarketConstituentDataset#

class quantlab.dataset.constituent.CrspMarketConstituentDataset(dataset_config)[source]#

Bases: IndexConstituentDataset

Daily point-in-time whole-market listing panel from CRSP.

This is not an index. Here is_member says whether a security was listed, and of the requested type, on each day, for every security in the CRSP reference directory at config.cache_dir. The listing spans come from CrspMarketRoster. A whole-market price panel has thousands of columns and is mostly NaN on any day; this mask lets a consumer tell “not listed” apart from “listed but did not trade”. The symbol axis is the int64 PERMNO, matching the CRSP price panel.

Coverage starts where CRSP’s daily prices begin (1925-12-31), and every interval ends no later than the last date of the downloaded CRSP data, so the panel never ends on today. The security filter changes what the panel means, so it is read from kwargs["security_filter"] (default "equity_common") and is thus recorded in the run’s config.json.

Parameters:
dataset_configFileConstituentDatasetConfig

Output Zarr path, CRSP reference directory (cache_dir), date range and optional kwargs["security_filter"].

Examples

Needs a CRSP reference directory on disk; no WRDS connection is made:

>>> config = FileConstituentDatasetConfig(
...     zarr_file_path="data/reference/crsp_market.zarr",
...     cache_dir="downloads/us_equity/1d/wrds_crsp/_reference",
...     start_date="2020-01-01",
...     end_date="2024-12-31",
...     kwargs={"security_filter": "equity_common"},
... )
>>> CrspMarketConstituentDataset(config).from_raw_data().save()
PIT_COVERAGE_START = '1925-12-31'#

First date of CRSP’s daily prices; there is no market universe before prices exist.

config_cls#

The config class a saved config.json is rebuilt with.

alias of FileConstituentDatasetConfig