Creating a control variable to determine the existence of max drawdown in the final result.

This commit is contained in:
Bruno Gouvea 2021-06-08 02:57:44 -03:00
parent 816bb531b3
commit 3cce668353
1 changed files with 3 additions and 1 deletions

View File

@ -222,10 +222,12 @@ class HyperoptTools():
# Ensure compatibility with older versions of hyperopt results
trials['results_metrics.winsdrawslosses'] = 'N/A'
has_drawdown = True
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
has_drawdown = False
legacy_mode = True
@ -278,7 +280,7 @@ class HyperoptTools():
stake_currency = config['stake_currency']
if not legacy_mode:
if has_drawdown:
trials['Max Drawdown'] = trials.apply(
lambda x: '{} {}'.format(
round_coin_value(x['max_drawdown_abs'], stake_currency),