Creating fake column for legacy mode on max drawdown
This commit is contained in:
parent
4595db39aa
commit
816bb531b3
@ -222,6 +222,11 @@ class HyperoptTools():
|
|||||||
# Ensure compatibility with older versions of hyperopt results
|
# Ensure compatibility with older versions of hyperopt results
|
||||||
trials['results_metrics.winsdrawslosses'] = 'N/A'
|
trials['results_metrics.winsdrawslosses'] = 'N/A'
|
||||||
|
|
||||||
|
if 'results_metrics.max_drawdown_abs' not in trials.columns:
|
||||||
|
# Ensure compatibility with older versions of hyperopt results
|
||||||
|
trials['results_metrics.max_drawdown_abs'] = None
|
||||||
|
trials['results_metrics.max_drawdown'] = None
|
||||||
|
|
||||||
legacy_mode = True
|
legacy_mode = True
|
||||||
|
|
||||||
if 'results_metrics.total_trades' in trials:
|
if 'results_metrics.total_trades' in trials:
|
||||||
@ -237,20 +242,18 @@ class HyperoptTools():
|
|||||||
'results_metrics.max_drawdown', 'results_metrics.max_drawdown_abs',
|
'results_metrics.max_drawdown', 'results_metrics.max_drawdown_abs',
|
||||||
'loss', 'is_initial_point', 'is_best']]
|
'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:
|
else:
|
||||||
# Legacy mode
|
# Legacy mode
|
||||||
trials = trials[['Best', 'current_epoch', 'results_metrics.trade_count',
|
trials = trials[['Best', 'current_epoch', 'results_metrics.trade_count',
|
||||||
'results_metrics.winsdrawslosses', 'results_metrics.avg_profit',
|
'results_metrics.winsdrawslosses', 'results_metrics.avg_profit',
|
||||||
'results_metrics.total_profit', 'results_metrics.profit',
|
'results_metrics.total_profit', 'results_metrics.profit',
|
||||||
'results_metrics.duration', 'loss', 'is_initial_point',
|
'results_metrics.duration', 'results_metrics.max_drawdown',
|
||||||
|
'results_metrics.max_drawdown_abs', 'loss', 'is_initial_point',
|
||||||
'is_best']]
|
'is_best']]
|
||||||
|
|
||||||
trials.columns = ['Best', 'Epoch', 'Trades', ' Win Draw Loss', 'Avg profit',
|
trials.columns = ['Best', 'Epoch', 'Trades', ' Win Draw Loss', 'Avg profit',
|
||||||
'Total profit', 'Profit', 'Avg duration', 'Objective',
|
'Total profit', 'Profit', 'Avg duration', 'Max Drawdown',
|
||||||
'is_initial_point', 'is_best']
|
'max_drawdown_abs', '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'] = '* '
|
||||||
@ -284,7 +287,10 @@ class HyperoptTools():
|
|||||||
if x['Max Drawdown'] != 0.0 else '--'.rjust(25 + len(stake_currency)),
|
if x['Max Drawdown'] != 0.0 else '--'.rjust(25 + len(stake_currency)),
|
||||||
axis=1
|
axis=1
|
||||||
)
|
)
|
||||||
trials = trials.drop(columns=['max_drawdown_abs'])
|
else:
|
||||||
|
trials = trials.drop(columns=['Max Drawdown'])
|
||||||
|
|
||||||
|
trials = trials.drop(columns=['max_drawdown_abs'])
|
||||||
|
|
||||||
trials['Profit'] = trials.apply(
|
trials['Profit'] = trials.apply(
|
||||||
lambda x: '{} {}'.format(
|
lambda x: '{} {}'.format(
|
||||||
|
Loading…
Reference in New Issue
Block a user