feat: get new name for aliased ccxt exchanges

This commit is contained in:
Matthias
2024-08-18 11:36:06 +02:00
parent 9e3e5038f7
commit 7cab973cbf
2 changed files with 6 additions and 1 deletions
+4
View File
@@ -2,6 +2,7 @@
Exchange support utils Exchange support utils
""" """
import inspect
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
from math import ceil, floor from math import ceil, floor
from typing import Any, Dict, List, Optional, Tuple from typing import Any, Dict, List, Optional, Tuple
@@ -101,6 +102,9 @@ def _build_exchange_list_entry(
"comment": comment, "comment": comment,
"dex": getattr(ex_mod, "dex", False), "dex": getattr(ex_mod, "dex", False),
"is_alias": getattr(ex_mod, "alias", False), "is_alias": getattr(ex_mod, "alias", False),
"alias_for": inspect.getmro(ex_mod.__class__)[1]().id
if getattr(ex_mod, "alias", False)
else None,
"trade_modes": [{"trading_mode": "spot", "margin_mode": ""}], "trade_modes": [{"trading_mode": "spot", "margin_mode": ""}],
} }
if resolved := exchangeClasses.get(exchange_name.lower()): if resolved := exchangeClasses.get(exchange_name.lower()):
+2 -1
View File
@@ -1,5 +1,5 @@
# Used for list-exchanges # Used for list-exchanges
from typing import List from typing import List, Optional
from typing_extensions import TypedDict from typing_extensions import TypedDict
@@ -17,4 +17,5 @@ class ValidExchangesType(TypedDict):
comment: str comment: str
dex: bool dex: bool
is_alias: bool is_alias: bool
alias_for: Optional[str]
trade_modes: List[TradeModeType] trade_modes: List[TradeModeType]