From 98e264f14c3b87880d6ae1c84db40197802ba60a Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 16 Jun 2026 17:33:11 +0200 Subject: [PATCH] refactor(b2): tilt uses statistics.median for consistency Co-Authored-By: Claude Opus 4.8 (1M context) --- src/fxhnt/domain/strategies/equity_factor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fxhnt/domain/strategies/equity_factor.py b/src/fxhnt/domain/strategies/equity_factor.py index 799b8ea..48339b5 100644 --- a/src/fxhnt/domain/strategies/equity_factor.py +++ b/src/fxhnt/domain/strategies/equity_factor.py @@ -70,7 +70,7 @@ def construction_weights(scores: list[float], construction: str, quantile: float if n == 0: return [] if construction == "tilt": - med = sorted(scores)[n // 2] + med = median(scores) pos = [max(0.0, s - med) for s in scores] tot = sum(pos) return [p / tot for p in pos] if tot > 0 else [1.0 / n] * n