diff --git a/freqtrade/util/rich_tables.py b/freqtrade/util/rich_tables.py index b8ec59d58..00c3302de 100644 --- a/freqtrade/util/rich_tables.py +++ b/freqtrade/util/rich_tables.py @@ -1,3 +1,4 @@ +import sys from typing import Any, Dict, List, Optional from rich.console import Console @@ -5,9 +6,13 @@ from rich.table import Table def print_rich_table( - tabular_data: List[Dict[str, Any]], headers: List[str], summary: Optional[str] = None + tabular_data: List[Dict[str, Any]], + headers: List[str], + summary: Optional[str] = None, + *, + table_kwargs: Optional[Dict[str, Any]] = None, ) -> None: - table = Table(title=summary) + table = Table(title=summary, **(table_kwargs or {})) for header in headers: table.add_column(header, justify="right") @@ -18,5 +23,7 @@ def print_rich_table( else: table.add_row(*row) - console = Console() + console = Console( + width=200 if "pytest" in sys.modules else None, + ) console.print(table)