Skip to content

Commit a180cb9

Browse files
committed
chore: Improve list-exchanges output
1 parent fbb757f commit a180cb9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

freqtrade/exchange/exchange_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
BAD_EXCHANGES,
2424
EXCHANGE_HAS_OPTIONAL,
2525
EXCHANGE_HAS_REQUIRED,
26+
MAP_EXCHANGE_CHILDCLASS,
2627
SUPPORTED_EXCHANGES,
2728
)
2829
from freqtrade.exchange.exchange_utils_timeframe import timeframe_to_minutes, timeframe_to_prev_date
@@ -91,21 +92,24 @@ def validate_exchange(exchange: str) -> tuple[bool, str, ccxt.Exchange | None]:
9192
def _build_exchange_list_entry(
9293
exchange_name: str, exchangeClasses: dict[str, Any]
9394
) -> ValidExchangesType:
95+
exchange_name = exchange_name.lower()
9496
valid, comment, ex_mod = validate_exchange(exchange_name)
97+
mapped_exchange_name = MAP_EXCHANGE_CHILDCLASS.get(exchange_name, exchange_name).lower()
98+
is_alias = getattr(ex_mod, "alias", False)
9599
result: ValidExchangesType = {
96100
"name": getattr(ex_mod, "name", exchange_name),
97101
"classname": exchange_name,
98102
"valid": valid,
99-
"supported": exchange_name.lower() in SUPPORTED_EXCHANGES,
103+
"supported": mapped_exchange_name in SUPPORTED_EXCHANGES and not is_alias,
100104
"comment": comment,
101105
"dex": getattr(ex_mod, "dex", False),
102-
"is_alias": getattr(ex_mod, "alias", False),
106+
"is_alias": is_alias,
103107
"alias_for": inspect.getmro(ex_mod.__class__)[1]().id
104108
if getattr(ex_mod, "alias", False)
105109
else None,
106110
"trade_modes": [{"trading_mode": "spot", "margin_mode": ""}],
107111
}
108-
if resolved := exchangeClasses.get(exchange_name.lower()):
112+
if resolved := exchangeClasses.get(mapped_exchange_name):
109113
supported_modes = [{"trading_mode": "spot", "margin_mode": ""}] + [
110114
{"trading_mode": tm.value, "margin_mode": mm.value}
111115
for tm, mm in resolved["class"]._supported_trading_mode_margin_pairs

0 commit comments

Comments
 (0)