quantlab.dataset.nbbo#
NBBO quote-bar panel built from raw WRDS TAQ quote files.
The NBBO (National Best Bid and Offer) is the best bid and the best ask
price for a US stock across all exchanges at each moment. TAQ (Trade and
Quote) is NYSE’s tick-level database of every trade and quote, sold through
WRDS (Wharton Research Data Services). A panel is an xarray.Dataset
indexed by timestamp and symbol, the format every quantlab layer
exchanges.
NbboPanelDataset reads the tick-level raw files that the WRDS TAQ
download writes (.../wrds/nbbo/date=.../symbol=.../*.pqt),
resamples each trading session onto a regular bar grid with
quantlab.dataset.nbbo.resample, and returns the panel the rest of the
pipeline stores and uses. Bars are right-closed: a bar labelled 09:31
covers quotes after 09:30 up to and including 09:31. The bar size is
NbboDatasetConfig.bar_interval, while the raw data’s frequency stays
"tick". Session opens and closes come from the NYSE (XNYS) exchange
calendar, which handles half days, daylight-saving changes and non-trading
days.
The panel’s symbol axis is the integer PERMNO, CRSP’s permanent security
id, the same axis the CRSP daily panels use. TAQ itself knows only tickers:
the raw files are keyed by the ticker a security traded under on that day,
and the conversion maps each raw (date, ticker) to its PERMNO through
the CRSP symbology (quantlab.dataset.crsp.symbology) read from
NbboDatasetConfig.reference_dir. A renamed security (FB, then META) is
therefore one column, and a ticker reused by two securities over time is
two. A raw ticker that no PERMNO used on that date is dropped, logged and
recorded in the filter-stats sidecar. The conversion also writes the same
ticker sidecar as the CRSP conversion (<store>.crsp_tickers.json), which
quantlab.dataset.crsp.tickers.CrspTickerLookup reads.
Everything but turning tick records into bars is shared with any NBBO bar
panel and lives in quantlab.dataset.nbbo.panel.NbboPanelBase.
Classes
Dense NBBO bar panel resampled from WRDS TAQ |
Modules