Merge pull request #3756 from allenday/patch-1

prettify hyperopt console output
This commit is contained in:
Matthias 2020-09-19 17:43:05 +02:00 committed by GitHub
commit 6674285b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -324,8 +324,9 @@ class Hyperopt:
'results_metrics.avg_profit', 'results_metrics.total_profit', 'results_metrics.avg_profit', 'results_metrics.total_profit',
'results_metrics.profit', 'results_metrics.duration', 'results_metrics.profit', 'results_metrics.duration',
'loss', 'is_initial_point', 'is_best']] 'loss', 'is_initial_point', 'is_best']]
trials.columns = ['Best', 'Epoch', 'Trades', 'W/D/L', 'Avg profit', 'Total profit', trials.columns = ['Best', 'Epoch', 'Trades', ' Win Draw Loss', 'Avg profit',
'Profit', 'Avg duration', 'Objective', 'is_initial_point', 'is_best'] 'Total profit', 'Profit', 'Avg duration', 'Objective',
'is_initial_point', 'is_best']
trials['is_profit'] = False trials['is_profit'] = False
trials.loc[trials['is_initial_point'], 'Best'] = '* ' trials.loc[trials['is_initial_point'], 'Best'] = '* '
trials.loc[trials['is_best'], 'Best'] = 'Best' trials.loc[trials['is_best'], 'Best'] = 'Best'
@ -574,7 +575,7 @@ class Hyperopt:
'wins': wins, 'wins': wins,
'draws': draws, 'draws': draws,
'losses': losses, 'losses': losses,
'winsdrawslosses': f"{wins}/{draws}/{losses}", 'winsdrawslosses': f"{wins:>4} {draws:>4} {losses:>4}",
'avg_profit': backtesting_results.profit_percent.mean() * 100.0, 'avg_profit': backtesting_results.profit_percent.mean() * 100.0,
'median_profit': backtesting_results.profit_percent.median() * 100.0, 'median_profit': backtesting_results.profit_percent.median() * 100.0,
'total_profit': backtesting_results.profit_abs.sum(), 'total_profit': backtesting_results.profit_abs.sum(),

View File

@ -813,7 +813,7 @@ def test_generate_optimizer(mocker, hyperopt_conf) -> None:
'draws': 0, 'draws': 0,
'duration': 100.0, 'duration': 100.0,
'losses': 0, 'losses': 0,
'winsdrawslosses': '1/0/0', 'winsdrawslosses': ' 1 0 0',
'median_profit': 2.3117, 'median_profit': 2.3117,
'profit': 2.3117, 'profit': 2.3117,
'total_profit': 0.000233, 'total_profit': 0.000233,