feat: saxo price
This commit is contained in:
@@ -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]]:
|
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
|
"""Daily OHLC bars via Saxo's Chart API (GET /chart/v3/charts, Horizon=1440 = daily
|
||||||
bars). NOT yet verified against a live account (unlike get_price_quote/
|
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
|
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.
|
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
|
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}, ...].
|
Returns oldest-first [{"date": "YYYY-MM-DD", "close": float}, ...].
|
||||||
"""
|
"""
|
||||||
instrument = resolve_instrument(symbol, asset_types=asset_type)
|
instrument = resolve_instrument(symbol, asset_types=asset_type)
|
||||||
data = _get("/chart/v1/charts", {
|
data = _get("/chart/v3/charts", {
|
||||||
"AssetType": asset_type,
|
"AssetType": asset_type,
|
||||||
"Uic": instrument["uic"],
|
"Uic": instrument["uic"],
|
||||||
"Horizon": 1440,
|
"Horizon": 1440,
|
||||||
|
|||||||
Reference in New Issue
Block a user