Don't break when running hyperopt-x tools on old resuts
This commit is contained in:
parent
35cea6dcfa
commit
4acb77305a
@ -310,12 +310,15 @@ class HyperoptTools():
|
|||||||
if not has_drawdown:
|
if not has_drawdown:
|
||||||
# Ensure compatibility with older versions of hyperopt results
|
# Ensure compatibility with older versions of hyperopt results
|
||||||
trials['results_metrics.max_drawdown_account'] = None
|
trials['results_metrics.max_drawdown_account'] = None
|
||||||
|
if 'is_random' not in trials.columns:
|
||||||
|
trials['is_random'] = False
|
||||||
|
|
||||||
# New mode, using backtest result for metrics
|
# New mode, using backtest result for metrics
|
||||||
trials['results_metrics.winsdrawslosses'] = trials.apply(
|
trials['results_metrics.winsdrawslosses'] = trials.apply(
|
||||||
lambda x: f"{x['results_metrics.wins']} {x['results_metrics.draws']:>4} "
|
lambda x: f"{x['results_metrics.wins']} {x['results_metrics.draws']:>4} "
|
||||||
f"{x['results_metrics.losses']:>4}", axis=1)
|
f"{x['results_metrics.losses']:>4}", axis=1)
|
||||||
|
|
||||||
|
|
||||||
trials = trials[['Best', 'current_epoch', 'results_metrics.total_trades',
|
trials = trials[['Best', 'current_epoch', 'results_metrics.total_trades',
|
||||||
'results_metrics.winsdrawslosses',
|
'results_metrics.winsdrawslosses',
|
||||||
'results_metrics.profit_mean', 'results_metrics.profit_total_abs',
|
'results_metrics.profit_mean', 'results_metrics.profit_total_abs',
|
||||||
|
Loading…
Reference in New Issue
Block a user