quantlab.portfolio.config.TopNConfig#

class quantlab.portfolio.config.TopNConfig(direction, top_n, score_label=None)[source]#

Bases: FrozenConfig

Config of TopNConstructor: equal-weight top-n selection.

Examples

>>> cfg = TopNConfig(direction="long_short", top_n=20)
>>> cfg.score_label is None
True
direction#

"long_only" holds the top top_n names; "long_short" also shorts the bottom top_n, with the two books disjoint.

score_label = None#

The label whose prediction ranks the symbols. None selects the predictor’s first label.

top_n#

Number of names selected per book at every rebalance.