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", ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
"trade_source", "ticker_interval"] "trade_source", "ticker_interval"]
ARGS_HYPEROPT_LIST = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_list_min_avg_time", ARGS_HYPEROPT_LIST = ["hyperopt_list_best", "hyperopt_list_profitable",
"hyperopt_list_max_avg_time", "hyperopt_list_min_avg_profit", "hyperopt_list_min_total_profit", "print_colorized", "hyperopt_list_min_avg_time", "hyperopt_list_max_avg_time",
"print_json", "hyperopt_list_no_details"] "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", ARGS_HYPEROPT_SHOW = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_show_index",
"print_json", "hyperopt_show_no_header"] "print_json", "hyperopt_show_no_header"]

View File

@ -51,7 +51,8 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
try: try:
# Human-friendly indexes used here (starting from 1) # Human-friendly indexes used here (starting from 1)
for val in trials[epoch_start:epoch_stop]: 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: except KeyboardInterrupt:
print('User interrupted..') print('User interrupted..')
@ -121,13 +122,26 @@ def _hyperopt_filter_trials(trials: List, filteroptions: dict) -> List:
if not filteroptions['only_best']: if not filteroptions['only_best']:
if filteroptions['filter_min_avg_time'] > 0: 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: 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: 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: 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)} " + logger.info(f"{len(trials)} " +
("best " if filteroptions['only_best'] else "") + ("best " if filteroptions['only_best'] else "") +