feat: saxo connector

This commit is contained in:
OpenSquared
2026-07-18 20:27:44 +02:00
parent dec5da37b1
commit d359480302
4 changed files with 110 additions and 7 deletions

View File

@@ -86,6 +86,19 @@ def snapshot_now(symbol: str):
return {"symbol": symbol.upper(), "rows_saved": len(rows)}
@router.get("/quote/{symbol}")
def quote(symbol: str, asset_type: str = Query("FxSpot")):
"""Basic (non-options) price test — isolates whether NoDataAccess is options-specific
or a broader account restriction, independently of the options-chain subscription."""
from services.saxo_client import get_price_quote, SaxoNotConnected, SaxoApiError
try:
return get_price_quote(symbol, asset_type=asset_type)
except SaxoNotConnected as e:
raise HTTPException(status_code=401, detail=str(e))
except (ValueError, SaxoApiError) as e:
raise HTTPException(status_code=502, detail=str(e))
@router.get("/history")
def history(
symbol: Optional[str] = Query(None),