feat: filter list-exchanges by dex

This commit is contained in:
Matthias
2025-08-03 19:44:52 +02:00
parent 12fbae7204
commit 887f513438
3 changed files with 10 additions and 1 deletions

View File

@@ -96,7 +96,7 @@ ARGS_LIST_HYPEROPTS = ["hyperopt_path", "print_one_column"]
ARGS_BACKTEST_SHOW = ["exportfilename", "backtest_show_pair_list", "backtest_breakdown"]
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all", "trading_mode"]
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all", "trading_mode", "dex_exchanges"]
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]

View File

@@ -369,6 +369,11 @@ AVAILABLE_CLI_OPTIONS = {
help="Print all exchanges known to the ccxt library.",
action="store_true",
),
"dex_exchanges": Arg(
"--dex-exchanges",
help="Print only DEX exchanges.",
action="store_true",
),
# List pairs / markets
"list_pairs_all": Arg(
"-a",

View File

@@ -47,6 +47,7 @@ def start_list_exchanges(args: dict[str, Any]) -> None:
table.add_column("Reason")
trading_mode = args.get("trading_mode", None)
dex_only = args.get("dex_exchanges", False)
for exchange in available_exchanges:
if trading_mode and not any(
@@ -54,6 +55,9 @@ def start_list_exchanges(args: dict[str, Any]) -> None:
):
# If trading_mode is specified, only show exchanges that support it
continue
if dex_only and not exchange.get("dex", False):
# If dex_only is specified, only show DEX exchanges
continue
name = Text(exchange["name"])
if exchange["supported"]:
name.append(" (Supported)", style="italic")