Simplify objective code formatting

This commit is contained in:
Matthias 2020-08-12 10:39:53 +02:00
parent 2dc36bb79e
commit 2fed066e76

View File

@ -140,6 +140,10 @@ def hyperopt_filter_epochs(epochs: List, filteroptions: dict) -> List:
epochs = _hyperopt_filter_epochs_objective(epochs, filteroptions) epochs = _hyperopt_filter_epochs_objective(epochs, filteroptions)
logger.info(f"{len(epochs)} " +
("best " if filteroptions['only_best'] else "") +
("profitable " if filteroptions['only_profitable'] else "") +
"epochs found.")
return epochs return epochs
@ -209,22 +213,11 @@ def _hyperopt_filter_epochs_objective(epochs: List, filteroptions: dict) -> List
if filteroptions['filter_min_objective'] is not None: if filteroptions['filter_min_objective'] is not None:
epochs = [x for x in epochs if x['results_metrics']['trade_count'] > 0] epochs = [x for x in epochs if x['results_metrics']['trade_count'] > 0]
# epochs = [x for x in epochs if x['loss'] != 20]
epochs = [ epochs = [x for x in epochs if x['loss'] < filteroptions['filter_min_objective']]
x for x in epochs
if x['loss'] < filteroptions['filter_min_objective']
]
if filteroptions['filter_max_objective'] is not None: if filteroptions['filter_max_objective'] is not None:
epochs = [x for x in epochs if x['results_metrics']['trade_count'] > 0] epochs = [x for x in epochs if x['results_metrics']['trade_count'] > 0]
# epochs = [x for x in epochs if x['loss'] != 20]
epochs = [
x for x in epochs
if x['loss'] > filteroptions['filter_max_objective']
]
logger.info(f"{len(epochs)} " + epochs = [x for x in epochs if x['loss'] > filteroptions['filter_max_objective']]
("best " if filteroptions['only_best'] else "") +
("profitable " if filteroptions['only_profitable'] else "") +
"epochs found.")
return epochs return epochs