feat: saxo history

This commit is contained in:
OpenSquared
2026-07-18 18:44:00 +02:00
parent ff242bd2a6
commit ca57f7d8d6
2 changed files with 39 additions and 5 deletions

View File

@@ -67,13 +67,13 @@ def symbols_with_history():
@router.post("/snapshot-now/{symbol}")
def snapshot_now(symbol: str):
from services.saxo_client import snapshot_options_chain, SaxoNotConnected
from services.saxo_client import snapshot_options_chain, SaxoNotConnected, SaxoApiError
from services.database import save_saxo_snapshot_rows
try:
rows = snapshot_options_chain(symbol)
except SaxoNotConnected as e:
raise HTTPException(status_code=401, detail=str(e))
except ValueError as e:
except (ValueError, SaxoApiError) as e:
raise HTTPException(status_code=502, detail=str(e))
save_saxo_snapshot_rows(rows)
return {"symbol": symbol.upper(), "rows_saved": len(rows)}