Scoring¶
Score builders for ranked / cross-sectional strategies.
Start with the topic guide for worked examples. Signatures below show the available arguments.
mean_reversion_score(lookback: int)¶
Inverts momentum_score, so larger scores favour recent losers. In the current implementation, inversion also turns its missing-history -inf into +inf. Guard history and finite results before ranking; this helper alone does not safely exclude missing history.
momentum_rank(series, lookback: int = 1) -> dict¶
Calculates return-based momentum scores across instruments rather than absolute price differences. Use its mapping with top_n/bottom_n. The lookback counts bars and requires valid history for each member.
momentum_score(lookback: int)¶
Creates a score_fn(symbol) using log return over lookback bars. It needs lookback+1 closes and returns -inf when history is insufficient. Higher means stronger proportional appreciation. See ranking.