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:
FrozenConfigFields 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,readandbuild.compute(start, end)requestswarmup_barsbars of the dataset beforestart, counted on the dataset’s own calendar, so rolling computations are warm at the first requested bar.Examples
With
dataseta 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
buildwrites the factor values to andreadreads 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;
Nonekeeps the dataset’s bars. The factor is computed on the dataset’s own bars first and aggregated afterwards. Set byresample().
- resample_how = None#
How each factor variable is aggregated into a resampled bar: one
ResampleMethodfor every variable, or a{variable: method}dict naming every variable. Required whenresample_freqis set.
- warmup_bars#
Bars of history read before the requested start to warm up rolling computations, counted on the dataset’s own calendar.