Displaying max. drawdown only when it is not legacy mode.
This commit is contained in:
		| @@ -221,6 +221,7 @@ class HyperoptTools(): | ||||
|         if 'results_metrics.winsdrawslosses' not in trials.columns: | ||||
|             # Ensure compatibility with older versions of hyperopt results | ||||
|             trials['results_metrics.winsdrawslosses'] = 'N/A' | ||||
|  | ||||
|         legacy_mode = True | ||||
|  | ||||
|         if 'results_metrics.total_trades' in trials: | ||||
| @@ -235,17 +236,22 @@ class HyperoptTools(): | ||||
|                              'results_metrics.profit_total', 'results_metrics.holding_avg', | ||||
|                              'results_metrics.max_drawdown', 'results_metrics.max_drawdown_abs', | ||||
|                              'loss', 'is_initial_point', 'is_best']] | ||||
|  | ||||
|             trials.columns = ['Best', 'Epoch', 'Trades', ' Win Draw Loss', 'Avg profit', | ||||
|                               'Total profit', 'Profit', 'Avg duration', 'Max Drawdown', | ||||
|                               'max_drawdown_abs', 'Objective', 'is_initial_point', 'is_best'] | ||||
|         else: | ||||
|             # Legacy mode | ||||
|             trials = trials[['Best', 'current_epoch', 'results_metrics.trade_count', | ||||
|                              'results_metrics.winsdrawslosses', | ||||
|                              'results_metrics.avg_profit', 'results_metrics.total_profit', | ||||
|                              'results_metrics.profit', 'results_metrics.duration', 'results_metrics.max_drawdown', | ||||
|                              'results_metrics.max_drawdown_abs', 'loss', 'is_initial_point', 'is_best']] | ||||
|                              'results_metrics.winsdrawslosses', 'results_metrics.avg_profit', | ||||
|                              'results_metrics.total_profit', 'results_metrics.profit', | ||||
|                              'results_metrics.duration', 'loss', 'is_initial_point', | ||||
|                              'is_best']] | ||||
|  | ||||
|             trials.columns = ['Best', 'Epoch', 'Trades', ' Win Draw Loss', 'Avg profit', | ||||
|                               'Total profit', 'Profit', 'Avg duration', 'Objective', | ||||
|                               'is_initial_point', 'is_best'] | ||||
|  | ||||
|         trials.columns = ['Best', 'Epoch', 'Trades', ' Win Draw Loss', 'Avg profit', | ||||
|                           'Total profit', 'Profit', 'Avg duration', 'Max Drawdown', 'max_drawdown_abs', | ||||
|                           'Objective', 'is_initial_point', 'is_best'] | ||||
|         trials['is_profit'] = False | ||||
|         trials.loc[trials['is_initial_point'], 'Best'] = '*     ' | ||||
|         trials.loc[trials['is_best'], 'Best'] = 'Best' | ||||
| @@ -269,15 +275,16 @@ class HyperoptTools(): | ||||
|  | ||||
|         stake_currency = config['stake_currency'] | ||||
|  | ||||
|         trials['Max Drawdown'] = trials.apply( | ||||
|             lambda x: '{} {}'.format( | ||||
|                 round_coin_value(x['max_drawdown_abs'], stake_currency), | ||||
|                 '({:,.2f}%)'.format(x['Max Drawdown'] * perc_multi).rjust(10, ' ') | ||||
|             ).rjust(25 + len(stake_currency)) | ||||
|             if x['Max Drawdown'] != 0.0 else '--'.rjust(25 + len(stake_currency)), | ||||
|             axis=1 | ||||
|         ) | ||||
|         trials = trials.drop(columns=['max_drawdown_abs']) | ||||
|         if not legacy_mode: | ||||
|             trials['Max Drawdown'] = trials.apply( | ||||
|                 lambda x: '{} {}'.format( | ||||
|                     round_coin_value(x['max_drawdown_abs'], stake_currency), | ||||
|                     '({:,.2f}%)'.format(x['Max Drawdown'] * perc_multi).rjust(10, ' ') | ||||
|                 ).rjust(25 + len(stake_currency)) | ||||
|                 if x['Max Drawdown'] != 0.0 else '--'.rjust(25 + len(stake_currency)), | ||||
|                 axis=1 | ||||
|             ) | ||||
|             trials = trials.drop(columns=['max_drawdown_abs']) | ||||
|  | ||||
|         trials['Profit'] = trials.apply( | ||||
|             lambda x: '{} {}'.format( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user