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:
25
backend/routers/reports.py
Normal file
25
backend/routers/reports.py
Normal 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
|
||||
Reference in New Issue
Block a user