Added test cases and fixed a minor bug
This commit is contained in:
@@ -120,24 +120,30 @@ def _hyperopt_filter_trials(trials: List, filteroptions: dict) -> List:
|
||||
if filteroptions['only_profitable']:
|
||||
trials = [x for x in trials if x['results_metrics']['profit'] > 0]
|
||||
|
||||
print(trials[0])
|
||||
|
||||
if not filteroptions['only_best']:
|
||||
if filteroptions['filter_min_avg_time'] > 0:
|
||||
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
|
||||
trials = [
|
||||
x for x in trials
|
||||
if x['results_metrics']['duration'] > filteroptions['filter_min_avg_time']
|
||||
]
|
||||
if filteroptions['filter_max_avg_time'] > 0:
|
||||
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
|
||||
trials = [
|
||||
x for x in trials
|
||||
if x['results_metrics']['duration'] < filteroptions['filter_max_avg_time']
|
||||
]
|
||||
if filteroptions['filter_min_avg_profit'] > 0:
|
||||
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
|
||||
trials = [
|
||||
x for x in trials
|
||||
if x['results_metrics']['avg_profit']
|
||||
> filteroptions['filter_min_avg_profit']
|
||||
]
|
||||
if filteroptions['filter_min_total_profit'] > 0:
|
||||
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
|
||||
trials = [
|
||||
x for x in trials
|
||||
if x['results_metrics']['profit'] > filteroptions['filter_min_total_profit']
|
||||
|
Reference in New Issue
Block a user