From e1e21bf912a81398ae36705eab20314c29594f62 Mon Sep 17 00:00:00 2001 From: OpenSquared Date: Sat, 18 Jul 2026 18:46:52 +0200 Subject: [PATCH] feat: saxo history --- backend/services/saxo_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/services/saxo_client.py b/backend/services/saxo_client.py index 09d1edb..e2007ef 100644 --- a/backend/services/saxo_client.py +++ b/backend/services/saxo_client.py @@ -74,9 +74,12 @@ def get_default_account_key() -> str: if _account_key_cache: return _account_key_cache data = _get("/port/v1/accounts/me") - account_key = _first(data, "AccountKey", "accountKey") + items = data.get("Data") or data.get("data") or [] + if not items: + raise ValueError(f"Aucun compte trouvé dans /port/v1/accounts/me: {data}") + account_key = _first(items[0], "AccountKey", "accountKey") if not account_key: - raise ValueError(f"Champ AccountKey introuvable dans /port/v1/accounts/me: {data}") + raise ValueError(f"Champ AccountKey introuvable pour le compte: {items[0]}") _account_key_cache = account_key return account_key