feat: saxo
This commit is contained in:
@@ -122,7 +122,11 @@ def resolve_instrument(symbol: str, asset_types: str = _OPTION_ASSET_TYPES) -> D
|
|||||||
if not items:
|
if not items:
|
||||||
raise ValueError(f"Aucun instrument Saxo trouvé pour '{symbol}' (AssetTypes={asset_types})")
|
raise ValueError(f"Aucun instrument Saxo trouvé pour '{symbol}' (AssetTypes={asset_types})")
|
||||||
|
|
||||||
item = items[0]
|
# An exact symbol match always wins over Saxo's own search ranking — e.g. searching
|
||||||
|
# "EURUSD" must resolve to the plain EURUSD root, not one of the "EURUSD Weekly (2)..."
|
||||||
|
# futures-option variants that also match the keyword and could rank first.
|
||||||
|
exact = next((i for i in items if str(_first(i, "Symbol", "symbol") or "").upper() == symbol.upper()), None)
|
||||||
|
item = exact or items[0]
|
||||||
uic = _first(item, "Identifier", "Uic", "uic")
|
uic = _first(item, "Identifier", "Uic", "uic")
|
||||||
if uic is None:
|
if uic is None:
|
||||||
raise ValueError(f"Champ Uic introuvable dans la réponse instruments pour '{symbol}': {item}")
|
raise ValueError(f"Champ Uic introuvable dans la réponse instruments pour '{symbol}': {item}")
|
||||||
|
|||||||
Reference in New Issue
Block a user