fix: align production defaults and close review parity gaps

Ship greenfield min_rr=2.0 and conf=0, read-only Structural S/R, indicator
cache invalidation, and UI/gate language that treats GTL as screening not exit.
Align strategy_rank missing-vol fallback live vs backtest, single-source
PRIMARY_TARGET_MIN_RR, expand prod parity tests, and drop dead FE clients.
This commit is contained in:
2026-07-18 13:03:22 +02:00
parent e07da0f8f0
commit b0e33e1606
25 changed files with 429 additions and 221 deletions
+14 -3
View File
@@ -71,10 +71,13 @@ async def test_ranks_universe_into_raw_percentiles_when_benchmark_missing(sessio
await _seed(session, "MID", rate=1.002)
await _seed(session, "LOW", rate=0.999) # declining → bottom momentum
ranks = await ms.compute_activation_ranks(session)
assert ranks["HIGH"]["momentum_percentile"] == 100.0
assert ranks["MID"]["momentum_percentile"] == 50.0
assert ranks["LOW"]["momentum_percentile"] == 0.0
# Thin momentum-only view stays aligned with the production ranker.
pct = await ms.compute_momentum_percentiles(session)
assert pct["HIGH"] == 100.0
assert pct["MID"] == 50.0
assert pct["LOW"] == 0.0
assert pct == {s: ranks[s]["momentum_percentile"] for s in pct}
async def test_ranks_universe_into_residual_percentiles_when_benchmark_available(session, monkeypatch):
@@ -91,6 +94,10 @@ async def test_ranks_universe_into_residual_percentiles_when_benchmark_available
await _seed_closes(session, "BETA", market)
await _seed_closes(session, "LAG", [market[i] * (0.9992 ** i) for i in range(n)])
ranks = await ms.compute_activation_ranks(session)
assert ranks["DRIFT"]["momentum_percentile"] == 100.0
assert ranks["BETA"]["momentum_percentile"] == 50.0
assert ranks["LAG"]["momentum_percentile"] == 0.0
pct = await ms.compute_momentum_percentiles(session)
assert pct["DRIFT"] == 100.0
assert pct["BETA"] == 50.0
@@ -105,6 +112,9 @@ async def test_short_history_ticker_is_unranked(session, monkeypatch):
await _seed(session, "LONG", rate=1.005)
await _seed(session, "SHORTHX", rate=1.005, n=100) # < 1y → no momentum
ranks = await ms.compute_activation_ranks(session)
assert "LONG" in ranks and ranks["LONG"]["momentum_percentile"] is not None
assert "SHORTHX" not in ranks or ranks["SHORTHX"]["momentum_percentile"] is None
pct = await ms.compute_momentum_percentiles(session)
assert "LONG" in pct
assert "SHORTHX" not in pct
@@ -115,4 +125,5 @@ async def test_empty_universe_returns_empty(session, monkeypatch):
return {}
monkeypatch.setattr(ms, "_load_activation_benchmark", no_benchmark)
assert await ms.compute_activation_ranks(session) == {}
assert await ms.compute_momentum_percentiles(session) == {}