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
def show_backtest_results(config: Dict, backtest_stats: Dict):
stake_currency = config['stake_currency']
for strategy, results in backtest_stats['strategy'].items():
def show_backtest_result(strategy: str, results: Dict[str, Any], stake_currency: str):
"""
Print results for one strategy
"""
# Print results
print(f"Result for strategy {strategy}")
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()
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:
# Print Strategy summary table