fix: ensure actual_json is computed for auto-generated templates
Auto-generated templates had no lag_days on edges → effective_lag_days=0 →
_drift_metrics used exact-date daily bar (often empty) → actual_json='{}' →
comprehensionScore returned null even after prediction_json was populated.
- Default effective_lag_days=5 when computed as 0 in _run_auto_analysis
- Add lag_days:3 to all auto-generated template edges in _build_graph_json_from_spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1091,7 +1091,8 @@ def _build_graph_json_from_spec(spec: dict) -> dict:
|
|||||||
"formula": inp_id + " * {{" + coef_name + "}}",
|
"formula": inp_id + " * {{" + coef_name + "}}",
|
||||||
})
|
})
|
||||||
edges.append({"from": inp_id, "to": inter_id,
|
edges.append({"from": inp_id, "to": inter_id,
|
||||||
"sign": "positive" if coef_val >= 0 else "negative", "style": "solid"})
|
"sign": "positive" if coef_val >= 0 else "negative", "style": "solid",
|
||||||
|
"lag_days": 3})
|
||||||
|
|
||||||
# Nœuds de sortie — étalés horizontalement en bas
|
# Nœuds de sortie — étalés horizontalement en bas
|
||||||
inter_ids = [n["id"] for n in intermediates]
|
inter_ids = [n["id"] for n in intermediates]
|
||||||
@@ -1115,7 +1116,8 @@ def _build_graph_json_from_spec(spec: dict) -> dict:
|
|||||||
"formula": from_id + " * {{" + coef_name + "}}",
|
"formula": from_id + " * {{" + coef_name + "}}",
|
||||||
})
|
})
|
||||||
edges.append({"from": from_id, "to": out_id,
|
edges.append({"from": from_id, "to": out_id,
|
||||||
"sign": "positive" if coef_val >= 0 else "negative", "style": "solid"})
|
"sign": "positive" if coef_val >= 0 else "negative", "style": "solid",
|
||||||
|
"lag_days": 3})
|
||||||
|
|
||||||
instruments = list({out.get("instrument", "EURUSD") for out in outputs})
|
instruments = list({out.get("instrument", "EURUSD") for out in outputs})
|
||||||
return {
|
return {
|
||||||
@@ -1252,6 +1254,8 @@ def _run_auto_analysis(event: dict, template_id: int) -> bool:
|
|||||||
# Effective lag from template edges (for price window and chip width)
|
# Effective lag from template edges (for price window and chip width)
|
||||||
edges = graph.get("edges", [])
|
edges = graph.get("edges", [])
|
||||||
effective_lag_days = max((e.get("lag_days", 0) or 0 for e in edges), default=0)
|
effective_lag_days = max((e.get("lag_days", 0) or 0 for e in edges), default=0)
|
||||||
|
if effective_lag_days == 0:
|
||||||
|
effective_lag_days = 5 # Default: measure close-to-close impact over 5 trading days
|
||||||
|
|
||||||
# Fetch actual prices to compute actual pips for scoring
|
# Fetch actual prices to compute actual pips for scoring
|
||||||
actual_moves: dict = {}
|
actual_moves: dict = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user