quantlab.dataset.base#

Dataset base classes: the read interface every dataset answers.

This module is the first layer of the pipeline (data, then factors, models and backtests). Every layer exchanges data as a panel: an xarray.Dataset indexed by timestamp and symbol, with one data variable per field (open, close, volume and so on). Panels are stored on disk as Zarr directories (a chunked array format), called stores below.

BaseDataset is the read interface shared by every dataset: a config with normalised ISO dates, panel(start, end, symbols, variables) (the one read seam of every leaf dataset, recorded in an open DataRecorder), calendar, bar_before and bar_after, resampling, the shared variable names, and each dataset’s declaration of the stores it reads (inputs, store_uses, stores). MarketDataset adds the market rules (tradable and delisting bars) and the to_kunquant export (arrays for the KunQuant factor engine).

Neither holds a build path. A dataset converted from a vendor’s raw files into a store it owns derives from quantlab.dataset.raw.RawDataset or RawMarketDataset and implements _raw_data_to_xr; a view (a roster cut, a merge, a mapping) and a panel held in memory derive from the classes here and have no build methods. The factor layer asks a dataset for a date range with panel(start, end) and counts warm-up with bar_before(date, n).

TickerLookup names a dataset’s symbol ids as of a day (ticker and company); a dataset says which one applies with ticker_lookup().

Classes

BaseDataset

The read interface shared by every dataset in quantlab.

MarketDataset

Dataset of market price bars, with a KunQuant export.

SymbolName

The readable name of one symbol on one day: its ticker and company.

TickerLookup

Names a dataset's symbol ids as of a day: the ticker and company in use.

Functions

bar_after_on

Return the bar n bars after date on the bars bars gives, or the last bar there is.

bar_before_on

Return the bar n bars before date on the bars bars gives.

stores_text

Return stores joined for an error message, or the in-memory text.