quantlab.factor.config.BaseFactorConfig#

class quantlab.factor.config.BaseFactorConfig(*, warmup_bars, dataset, file_path=None, factor_names=None, kwargs=None, resample_freq=None, resample_how=None, name=None)[source]#

Bases: FrozenConfig

Fields every factor (and label) shares, whichever backend computes it.

The config says what is computed, not when: the date range is an argument of compute, read and build. compute(start, end) requests warmup_bars bars of the dataset before start, counted on the dataset’s own calendar, so rolling computations are warm at the first requested bar.

Examples

With dataset a market dataset built earlier:

>>> cfg = BaseFactorConfig(
...     warmup_bars=20,
...     dataset=dataset,
...     file_path="/data/factor/momentum.zarr",
... )
>>> cfg.factor_names, cfg.warmup_bars
(None, 20)
dataset#

The market dataset the factor is computed from, or a list of them, which the factor merges into one MergedDataset.

factor_names = None#

Names of the factor variables this factor produces; filled from the factor definition when left None.

file_path = None#

Path of the Zarr store build writes the factor values to and read reads them back from.

kwargs = None#

Free-form options a specific factor class may read.

name = None#

Dotted import path of the factor class; filled by the config setter.

resample_freq = None#

Bar size the computed factor panel is resampled onto; None keeps the dataset’s bars. The factor is computed on the dataset’s own bars first and aggregated afterwards. Set by resample().

resample_how = None#

How each factor variable is aggregated into a resampled bar: one ResampleMethod for every variable, or a {variable: method} dict naming every variable. Required when resample_freq is set.

warmup_bars#

Bars of history read before the requested start to warm up rolling computations, counted on the dataset’s own calendar.