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.

@FunctionalInterface public interface AlphaFactor
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();
  • NaN means "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 in Factors.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Human-readable name used in reports; override for real factors.
    double[]
    scores(AlphaContext ctx, int index)
    Raw scores at index, aligned with the context's symbols.
  • Method Details

    • scores

      double[] scores(AlphaContext ctx, int index)
      Raw scores at index, aligned with the context's symbols.
    • name

      default String name()
      Human-readable name used in reports; override for real factors.