feat(phase6): per-feature signal attribution in log-odds space
CI/CD / build-and-push (push) Successful in 1m56s
CI/CD / build-and-push (push) Successful in 1m56s
Adds feat_fg_lo / feat_mom_lo / feat_news_lo / feat_mfld_lo / feat_btc_dom_lo to every trade, all normalized to log-odds contribution for direct comparability. - fg / mom / btc_dom: raw probability-delta × 2 → log-odds - news / mfld: already log-odds (LOGODDS_WEIGHT already applied), no scaling - btc_dom tracked separately in bayesian.py instead of bundled in total_adj - reasoning string updated to fg_lo= / mom_lo= notation for self-documentation Schema: 5 new DOUBLE PRECISION columns + 2 partial indexes Stack: TradingSignal → Order → Trade → save_trade all carry feat fields Startup: backfill_feature_columns() recovers fg/mom/news/mfld from old reasoning strings (×2 applied to fg/mom); btc_dom_lo stays NULL for legacy API: /api/metrics/features — triggered/material split per feature with two-level thresholds (0.05 for fg/mom/btc_dom, 0.10 for news/mfld) API: /api/trades/legacy — exposes pre-Phase-1 trades (edge_net IS NULL) API: _enrich_trade backward-compat: reads DB columns first, falls back to reasoning regex with unit conversion for pre-Phase-6 trades Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,12 @@ class Order:
|
||||
family_key: str = ""
|
||||
# Phase 4 — regime threshold applied
|
||||
regime_min_edge: float = 0.10
|
||||
# Phase 6 — per-feature log-odds contributions (see TradingSignal for semantics)
|
||||
feat_fg_lo: float = 0.0
|
||||
feat_mom_lo: float = 0.0
|
||||
feat_news_lo: float = 0.0
|
||||
feat_mfld_lo: float = 0.0
|
||||
feat_btc_dom_lo: float = 0.0
|
||||
|
||||
|
||||
class RiskManager:
|
||||
@@ -147,4 +153,10 @@ class RiskManager:
|
||||
family_key=signal.family_key,
|
||||
# Phase 4 — regime
|
||||
regime_min_edge=signal.regime_min_edge,
|
||||
# Phase 6 — feature log-odds
|
||||
feat_fg_lo=signal.feat_fg_lo,
|
||||
feat_mom_lo=signal.feat_mom_lo,
|
||||
feat_news_lo=signal.feat_news_lo,
|
||||
feat_mfld_lo=signal.feat_mfld_lo,
|
||||
feat_btc_dom_lo=signal.feat_btc_dom_lo,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user