feat: market event

This commit is contained in:
OpenSquared
2026-06-29 12:49:12 +02:00
parent 79593a8fd3
commit ac441ad5cb
2 changed files with 40 additions and 3 deletions

View File

@@ -257,7 +257,11 @@ def _gpt4o_recommend(event: dict, templates: list) -> dict:
system_prompt = (
"You are a macro market analyst and causal graph specialist for the GeoOptions platform. "
"Given a market event and a library of causal graph templates, recommend the most appropriate template "
"and suggest any coefficient adjustments. Respond with a JSON object only."
"and suggest any coefficient adjustments. Respond with a JSON object only.\n"
"IMPORTANT: Only recommend a template if it is structurally compatible with the event type "
"(same causal mechanism — e.g. do NOT recommend an ECB rate decision template for a sentiment survey). "
"If no template fits well (structural mismatch, confidence < 0.6), set template_id to null "
"and explain in 'notes' what kind of template would be needed."
)
user_prompt = f"""Market event to analyze:
@@ -875,6 +879,15 @@ def analyze_event(body: AnalyzeRequest):
pass
# Sources legacy
elif src == "surprise_bps" and event.get("surprise_pct") is not None:
# Valeur brute en bps (ex: écart taux BCE en points de base)
raw = float(event["surprise_pct"])
node_range = cfg.get("range")
if node_range and len(node_range) == 2:
lo, hi = float(node_range[0]), float(node_range[1])
inputs[input_id] = round(max(lo, min(hi, raw)), 4)
else:
inputs[input_id] = round(raw, 4)
elif src == "surprise" and event.get("surprise_pct") is not None:
raw = float(event["surprise_pct"])
node_range = cfg.get("range")