quantlab.factor.predefined.intraday.IntradayComposite#
- class quantlab.factor.predefined.intraday.IntradayComposite(config)[source]#
Bases:
FactorEqual-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 overwindowbars, 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 (KunQuantRank, 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) - 1stored bars beforestarttoend, so it must be built over the range first. The firstwindow - 1bars of the store are NaN in every part that window covers.- Parameters:
- configIntradayCompositeConfig
The wrapped
factorand thecomposites.
- Raises:
- ValueError
If
warmup_barsis 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
nbars afterdateon the wrapped factor’s calendar.See
Factor.bar_afterfor 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
nbars beforedateon the wrapped factor’s calendar.See
Factor.bar_beforefor 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
starttoend, 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; seeFactor.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
starttoend, both inclusive.- Raises:
- ValueError
If
startis afterend, the wrapped factor has no store or its store does not coverend.
Examples
>>> signals.compute("2024-06-03", "2024-06-28")["small_lit_trades"].sizes["timestamp"] 19
- property config#
The factor’s normalised config:
nameandfactor_namesfilled in.Examples
>>> factor.config is config False >>> factor.config.name, config.name ('quantlab.factor.predefined.momentum.Momentum', None)
- config_cls#
The config class
from_configrebuilds this factor with.alias of
IntradayCompositeConfig