feat: Rapport de Cycle — auto-généré à chaque run avec contexte IA, delta, PnL/VaR snapshot

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-20 07:57:41 +02:00
parent 85975f6248
commit e2d5bebef4
6 changed files with 760 additions and 473 deletions

View File

@@ -0,0 +1,25 @@
from fastapi import APIRouter, HTTPException
from services.database import get_cycle_reports, get_cycle_report, get_latest_cycle_report
router = APIRouter(prefix="/api/reports", tags=["reports"])
@router.get("/cycle/latest")
def cycle_report_latest():
"""Most recent generated cycle report."""
return {"report": get_latest_cycle_report()}
@router.get("/cycle/list")
def cycle_report_list(limit: int = 20):
"""List of cycle report summaries (no full JSON)."""
return {"reports": get_cycle_reports(limit)}
@router.get("/cycle/{run_id}")
def cycle_report_detail(run_id: str):
"""Full cycle report for a specific run_id."""
report = get_cycle_report(run_id)
if not report:
raise HTTPException(404, "Rapport de cycle introuvable")
return report