Extract show_backtest_result for one strategy

This commit is contained in:
Matthias 2021-05-01 11:24:32 +02:00
parent 97478abb9d
commit 420e75af65

View File

@ -567,11 +567,10 @@ def text_table_add_metrics(strat_results: Dict) -> str:
return message return message
def show_backtest_results(config: Dict, backtest_stats: Dict): def show_backtest_result(strategy: str, results: Dict[str, Any], stake_currency: str):
stake_currency = config['stake_currency'] """
Print results for one strategy
for strategy, results in backtest_stats['strategy'].items(): """
# Print results # Print results
print(f"Result for strategy {strategy}") print(f"Result for strategy {strategy}")
table = text_table_bt_results(results['results_per_pair'], stake_currency=stake_currency) table = text_table_bt_results(results['results_per_pair'], stake_currency=stake_currency)
@ -599,6 +598,13 @@ def show_backtest_results(config: Dict, backtest_stats: Dict):
print('=' * len(table.splitlines()[0])) print('=' * len(table.splitlines()[0]))
print() print()
def show_backtest_results(config: Dict, backtest_stats: Dict):
stake_currency = config['stake_currency']
for strategy, results in backtest_stats['strategy'].items():
show_backtest_result(strategy, results, stake_currency)
if len(backtest_stats['strategy']) > 1: if len(backtest_stats['strategy']) > 1:
# Print Strategy summary table # Print Strategy summary table