Interface AlphaFactor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A cross-sectional alpha factor: at a bar index, one raw score per symbol,
where higher = more attractive to own (buy high scores, sell low).
Scores are raw, in whatever natural unit the factor has
(return spread, z-score, yield). Normalization into portfolio weights is
deliberately a separate step (PortfolioConstruction) so that the
same factor can be evaluated rank-wise (SignalEvaluator uses rank
IC, which is scale-invariant) and constructed under different schemes
without re-implementing the signal.
Contract:
- the returned array aligns with
AlphaContext.symbols(); NaNmeans "no score" (insufficient history, missing fundamentals) — every downstream step skips NaN entries;- implementations must only read bars
<= index: a factor that peeks forward invalidates every evaluation built on it. The validation suite cannot detect look-ahead mechanically — this contract is the guard; - custom factors should honor
AlphaContext.isActive(int, int)(return NaN for inactive names) the way the built-ins do, so an attached point-in-time universe removes dead/non-member names from the cross-section everywhere, not just inFactors.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Stringname()Human-readable name used in reports; override for real factors.double[]scores(AlphaContext ctx, int index) Raw scores atindex, aligned with the context's symbols.
-
Method Details
-
scores
Raw scores atindex, aligned with the context's symbols. -
name
Human-readable name used in reports; override for real factors.
-