diff --git a/freqtrade/commands/list_commands.py b/freqtrade/commands/list_commands.py index ea2c84ae9..e0f5d2d62 100644 --- a/freqtrade/commands/list_commands.py +++ b/freqtrade/commands/list_commands.py @@ -280,7 +280,7 @@ def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None: writer.writeheader() writer.writerows(tabular_data) else: - print_rich_table(summary_str, headers, tabular_data) + print_rich_table(tabular_data, headers, summary_str) elif not ( args.get("print_one_column", False) or args.get("list_pairs_print_json", False) diff --git a/freqtrade/util/rich_tables.py b/freqtrade/util/rich_tables.py index f773a4fd1..b8ec59d58 100644 --- a/freqtrade/util/rich_tables.py +++ b/freqtrade/util/rich_tables.py @@ -1,17 +1,22 @@ -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional from rich.console import Console from rich.table import Table -def print_rich_table(summary: str, headers: List[str], tabular_data: List[Dict[str, Any]]) -> None: +def print_rich_table( + tabular_data: List[Dict[str, Any]], headers: List[str], summary: Optional[str] = None +) -> None: table = Table(title=summary) for header in headers: table.add_column(header, justify="right") for row in tabular_data: - table.add_row(*[str(row[header]) for header in headers]) + if isinstance(row, dict): + table.add_row(*[str(row[header]) for header in headers]) + else: + table.add_row(*row) console = Console() console.print(table)