quantlab.factor.predefined.intraday.IntradayComposite#

class quantlab.factor.predefined.intraday.IntradayComposite(config)[source]#

Bases: Factor

Equal-weight combinations of the cross-sectional ranks of trailing statistics of a stored factor.

Meant for a resampled IntradayStats. Each output combines its parts (IntradayCompositeConfig.composites): a part is the trailing mean, or the coefficient of variation (sample standard deviation over mean), of one stored output over window bars, missing values skipped and NaN with fewer than half the window present; negated when its sign is -; then ranked across the symbols of the bar (KunQuant Rank, in (0, 1], over the symbols with a value). The output is the mean of its parts’ ranks, NaN when any part is missing: the usual way to join weak, partly independent signals without fitting weights. Ranks are taken over every symbol of the wrapped factor’s panel, so compute it on the whole market and read it on a roster (RosterFactor, MembershipMaskedFactor).

The wrapped factor’s store is read from max(window) - 1 stored bars before start to end, so it must be built over the range first. The first window - 1 bars of the store are NaN in every part that window covers.

Parameters:
configIntradayCompositeConfig

The wrapped factor and the composites.

Raises:
ValueError

If warmup_bars is not 0, the config is resampled, there is no composite, a composite has no part, or a part does not parse or names an output the wrapped factor lacks.

Examples

>>> signals = IntradayComposite(IntradayCompositeConfig(factor=daily, composites={
...     "small_lit_trades": ("-trade_size:mean:60", "-offexchange_share:mean:60"),
... }))
>>> signals.get_factor_names()
('small_lit_trades',)
bar_after(date, n)[source]#

Return the bar n bars after date on the wrapped factor’s calendar.

See Factor.bar_after for the rules.

Examples

>>> signals.bar_after("2024-03-01", 1) == daily.bar_after("2024-03-01", 1)
True
bar_before(date, n)[source]#

Return the bar n bars before date on the wrapped factor’s calendar.

See Factor.bar_before for the rules and errors.

Examples

>>> signals.bar_before("2024-03-29", 1) == daily.bar_before("2024-03-29", 1)
True
calendar(start, end)[source]#

Return the wrapped factor’s bars from start to end, both inclusive.

The composites are on the wrapped factor’s bars (the daily bars of a resampled IntradayStats), not on the minute bars of the dataset it holds; see Factor.calendar.

Examples

>>> signals.calendar("2024-03-01", "2024-03-29").equals(daily.calendar("2024-03-01", "2024-03-29"))
True
compute(start, end)[source]#

Combine the wrapped store’s statistics from start to end, both inclusive.

Raises:
ValueError

If start is after end, the wrapped factor has no store or its store does not cover end.

Examples

>>> signals.compute("2024-06-03", "2024-06-28")["small_lit_trades"].sizes["timestamp"]
19
property config#

The factor’s normalised config: name and factor_names filled in.

Examples

>>> factor.config is config
False
>>> factor.config.name, config.name
('quantlab.factor.predefined.momentum.Momentum', None)
config_cls#

The config class from_config rebuilds this factor with.

alias of IntradayCompositeConfig

output_symbols()[source]#

Return the wrapped factor’s output symbols.

Examples

>>> signals.output_symbols() == daily.output_symbols()
True