quantlab.dataset.config.NbboDatasetConfig#

class quantlab.dataset.config.NbboDatasetConfig(*, zarr_file_path, start_date=None, end_date=None, symbols=None, kwargs=None, resample_freq=None, resample_how=None, name=None, raw_data_dir_path, market='us_equity', frequency='tick', vendor='wrds', reference_dir, permnos=None, bar_interval='1m', session_start='09:30', session_end='16:00', drop_crossed=True, drop_locked=False, drop_nonpositive_price=True, keep_qu_cond=None)[source]#

Bases: DatasetConfig

Config of the intraday bar panel built from WRDS TAQ NBBO quotes.

frequency stays "tick" (the raw tier holds one row per NBBO record); the size of the bars the panel is resampled to is the separate bar_interval. The four drop_* and keep_* fields are the resampler’s record filter and are config fields, not kwargs, so a rebuild from config.json reproduces the panel exactly.

The panel’s symbol axis is the integer PERMNO, the same axis as the CRSP panels, although the raw TAQ files are keyed by ticker. The conversion maps each raw (date, ticker) to its PERMNO through the CRSP symbology in reference_dir, so the inherited ticker-side symbols field is refused by the dataset’s config setter; use permnos instead. See docs/user-guide/wrds.md.

Examples

>>> cfg = NbboDatasetConfig(
...     zarr_file_path="/data/us_equity/tick/nbbo_5m.zarr",
...     raw_data_dir_path="/data/downloads/us_equity/tick/wrds",
...     reference_dir="/data/downloads/_reference",
...     bar_interval="5m",
...     start_date="2024-01-02",
...     end_date="2024-01-31",
...     permnos=("14593",),
... )
>>> cfg.frequency, cfg.bar_interval, cfg.drop_crossed
('tick', '5m', True)
bar_interval = '1m'#

Bar size the tick records are resampled to.

drop_crossed = True#

Drop records whose bid exceeds the ask (both sides present).

drop_locked = False#

Drop records whose bid equals the ask.

drop_nonpositive_price = True#

Drop records carrying a non-positive price.

frequency = 'tick'#

Always tick: the raw tier is one row per NBBO record.

keep_qu_cond = None#

Keep only these qu_cond quote conditions. None keeps every condition.

market = 'us_equity'#

Always US equity for this vendor.

permnos = None#

Restrict the panel to these PERMNOs, as digit strings. None means every PERMNO the raw tier’s tickers resolve to; an empty tuple is refused at config assignment because it could mean either “none” or “all”. A listed PERMNO is on the axis even when the raw tier has no record for it, as an all-NaN column.

reference_dir#

Directory of the CRSP reference tables (stksecurityinfohist and friends) the conversion reads its symbology from: the mapping from a ticker on a date to the PERMNO that traded under it. The same directory scripts/wrds/index.py fills for the CRSP panels.

session_end = '16:00'#

End of the session window, US/Eastern wall clock HH:MM.

session_start = '09:30'#

Start of the session window, US/Eastern wall clock HH:MM.

vendor = 'wrds'#

Always WRDS for this dataset.