feat: saxo history
This commit is contained in:
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user