quantlab.factor.predefined.alpha101.Alpha101SpotKline#

class quantlab.factor.predefined.alpha101.Alpha101SpotKline(factor_config)[source]#

Bases: TimeSeriesZScoredFactor

Alpha101 factors over crypto spot klines, z-scored along time.

Reads the lowercase open, high, low, close, volume and amount (traded value in quote currency) columns of the spot kline dataset. Every output is wrapped in WindowedZScore over zscore_window bars (kwargs["zscore_window"], default 20), which standardizes each symbol against its own trailing window. That time-series normalization suits the strategies spot data is traded with here, which follow one asset over time. The US-equity sibling Alpha101Stock z-scores across symbols instead, because it serves cross-sectional strategies that compare symbols on the same bar. The two classes are intentionally different.

Parameters:
factor_configFactorConfig

The KunQuant factor config. kwargs["zscore_window"] sets the z-score window. warmup_bars must cover the longest alpha lookback plus zscore_window - 1 bars for the first requested bar to be fully normalized. data_columns lists the six input columns above, and factor_names selects which alphas to compute (all 101 when unset).

Examples

>>> factor = Alpha101SpotKline(FactorConfig(
...     warmup_bars=60, dataset=dataset, mode="batch",
...     data_columns=["open", "high", "low", "close", "volume", "amount"],
...     factor_names=["alpha001", "alpha002"], kwargs={"zscore_window": 20},
...     file_path="alpha101.zarr",
... ))
>>> panel = factor.compute("2024-01-01", "2024-06-30")