Skip to content

Commit f838db6

Browse files
committed
fix: show balance also for old backtests
1 parent e8501df commit f838db6

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

freqtrade/optimize/optimize_reports/bt_output.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -287,24 +287,27 @@ def text_table_add_metrics(strat_results: dict) -> None:
287287
if "trading_mode" in strat_results
288288
else []
289289
)
290-
wallet_metrics: list[tuple[str, str]] = []
290+
wallet_metrics: list[tuple[str, str]] = [
291+
(
292+
"Min/Max balance realized",
293+
f"{fmt_coin(strat_results['csum_min'], stake)} / "
294+
f"{fmt_coin(strat_results['csum_max'], stake)}",
295+
),
296+
]
291297
if wallet_stats := strat_results.get("wallet_stats"):
292-
wallet_metrics = [
293-
(
294-
"Min/Max balance realized",
295-
f"{fmt_coin(strat_results['csum_min'], stake)} / "
296-
f"{fmt_coin(strat_results['csum_max'], stake)}",
297-
),
298-
(
299-
"Min/Max balance unrealized",
300-
f"{fmt_coin(wallet_stats['low_balance'], stake)} / "
301-
f"{fmt_coin(wallet_stats['high_balance'], stake)}",
302-
),
303-
(
304-
"Min/Max balance dates",
305-
f"{wallet_stats['low_date']} / {wallet_stats['high_date']}",
306-
),
307-
]
298+
wallet_metrics.extend(
299+
[
300+
(
301+
"Min/Max balance unrealized",
302+
f"{fmt_coin(wallet_stats['low_balance'], stake)} / "
303+
f"{fmt_coin(wallet_stats['high_balance'], stake)}",
304+
),
305+
(
306+
"Min/Max balance dates",
307+
f"{wallet_stats['low_date']} / {wallet_stats['high_date']}",
308+
),
309+
]
310+
)
308311

309312
# Newly added fields should be ignored if they are missing in strat_results. hyperopt-show
310313
# command stores these results and newer version of freqtrade must be able to handle old

0 commit comments

Comments
 (0)