feat: saxo price

This commit is contained in:
OpenSquared
2026-07-23 17:34:10 +02:00
parent 348fe05f7f
commit 151c347ab1

View File

@@ -241,8 +241,10 @@ def get_price_quote(symbol: str, asset_type: str = "FxSpot", amount: int = 10000
def get_price_history(symbol: str, asset_type: str = "FxSpot", days: int = 90) -> List[Dict[str, Any]]:
"""Daily OHLC bars via Saxo's Chart API (GET /chart/v1/charts, Horizon=1440 = daily
bars). NOT yet verified against a live account (unlike get_price_quote/
"""Daily OHLC bars via Saxo's Chart API (GET /chart/v3/charts, Horizon=1440 = daily
bars). v1 confirmed dead (plain HTML 404, not a Saxo JSON error — 2026-07-23 live
test) — Saxo has iterated this service's version over time, v3 is the current best
guess, NOT yet verified against a live account (unlike get_price_quote/
snapshot_options_chain, which were built against confirmed real responses) — this
follows Saxo's documented chart endpoint shape but needs a live check once deployed.
Callers should treat any failure here (wrong field names, entitlement gap, etc.) as
@@ -250,7 +252,7 @@ def get_price_history(symbol: str, asset_type: str = "FxSpot", days: int = 90) -
Returns oldest-first [{"date": "YYYY-MM-DD", "close": float}, ...].
"""
instrument = resolve_instrument(symbol, asset_types=asset_type)
data = _get("/chart/v1/charts", {
data = _get("/chart/v3/charts", {
"AssetType": asset_type,
"Uic": instrument["uic"],
"Horizon": 1440,