Class RankingEngine
Why normalize before blending: raw metrics live on wildly different
scales (ROE ~0.15, market cap ~1e11), so a weighted sum of raw values
is just "whichever metric has the biggest units wins". Min-max
normalization maps each criterion to [0,1] ACROSS THE CANDIDATE SET
first; the weights then express genuine relative importance. Two
consequences to design around: scores are relative to this run's
universe (the same stock scores differently in a different candidate
list — fine for "pick the best 20 today", wrong for tracking one name
through time), and min-max is outlier-sensitive (one absurd P/E
compresses everyone else's spread; screen out garbage with
FundamentalFilters BEFORE ranking, which is the intended
pipeline order). Negative weights invert a criterion — lower P/E
ranks higher — without a separate "ascending" flag.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCriterion(String name, double weight, ToDoubleFunction<StockSnapshot> extractor) rank(List<StockSnapshot> stocks)
-
Constructor Details
-
RankingEngine
public RankingEngine()
-
-
Method Details
-
addCriterion
public RankingEngine addCriterion(String name, double weight, ToDoubleFunction<StockSnapshot> extractor) - Parameters:
weight- relative importance; use a negative weight to prefer smaller values (e.g. lower P/E ranks higher)extractor- metric to score, e.g.s -> s.fundamentals().roe()
-
rank
-