Fixed to pass PEP8

This commit is contained in:
Fredrik Rydin 2020-02-09 00:16:11 +01:00
parent 636bd5acb5
commit c96acd6ca0
2 changed files with 25 additions and 10 deletions

View File

@ -59,9 +59,10 @@ ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit",
ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
"trade_source", "ticker_interval"]
ARGS_HYPEROPT_LIST = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_list_min_avg_time",
"hyperopt_list_max_avg_time", "hyperopt_list_min_avg_profit", "hyperopt_list_min_total_profit", "print_colorized",
"print_json", "hyperopt_list_no_details"]
ARGS_HYPEROPT_LIST = ["hyperopt_list_best", "hyperopt_list_profitable",
"hyperopt_list_min_avg_time", "hyperopt_list_max_avg_time",
"hyperopt_list_min_avg_profit", "hyperopt_list_min_total_profit",
"print_colorized", "print_json", "hyperopt_list_no_details"]
ARGS_HYPEROPT_SHOW = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_show_index",
"print_json", "hyperopt_show_no_header"]

View File

@ -32,7 +32,7 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', 0.0),
'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', 0.0)
}
trials_file = (config['user_data_dir'] /
'hyperopt_results' / 'hyperopt_results.pickle')
@ -51,7 +51,8 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
try:
# Human-friendly indexes used here (starting from 1)
for val in trials[epoch_start:epoch_stop]:
Hyperopt.print_results_explanation(val, total_epochs, not filteroptions['only_best'], print_colorized)
Hyperopt.print_results_explanation(val, total_epochs,
not filteroptions['only_best'], print_colorized)
except KeyboardInterrupt:
print('User interrupted..')
@ -121,14 +122,27 @@ def _hyperopt_filter_trials(trials: List, filteroptions: dict) -> List:
if not filteroptions['only_best']:
if filteroptions['filter_min_avg_time'] > 0:
trials = [x for x in trials if x['results_metrics']['duration'] > filteroptions['filter_min_avg_time']]
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']['duration'] < filteroptions['filter_max_avg_time']]
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']['avg_profit'] > filteroptions['filter_min_avg_profit']]
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']['profit'] > filteroptions['filter_min_total_profit']]
trials = [
x for x in trials
if x['results_metrics']['profit'] > filteroptions['filter_min_total_profit']
]
logger.info(f"{len(trials)} " +
("best " if filteroptions['only_best'] else "") +
("profitable " if filteroptions['only_profitable'] else "") +