feat: causal lab

This commit is contained in:
OpenSquared
2026-06-28 14:18:43 +02:00
parent 20f1897211
commit 863ba67610
4 changed files with 247 additions and 97 deletions

View File

@@ -853,9 +853,10 @@ def analyze_event(body: AnalyzeRequest):
@router.get("/api/causal-lab/analyses")
def list_analyses(
template_id: int = Query(0),
instrument: str = Query(""),
limit: int = Query(100, le=500),
template_id: int = Query(0),
market_event_id: int = Query(0),
instrument: str = Query(""),
limit: int = Query(100, le=500),
):
try:
from services.database import get_conn
@@ -865,6 +866,8 @@ def list_analyses(
conditions = ["1=1"]
if template_id:
conditions.append(f"a.template_id = {template_id}")
if market_event_id:
conditions.append(f"a.market_event_id = {market_event_id}")
if instrument:
conditions.append(f"a.instrument = '{instrument}'")
where = " AND ".join(conditions)