initial push
This commit is contained in:
@@ -69,6 +69,7 @@ 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_max_avg_profit",
|
||||
"hyperopt_list_min_total_profit", "hyperopt_list_max_total_profit",
|
||||
"hyperopt_list_min_objective", "hyperopt_list_max_objective",
|
||||
"print_colorized", "print_json", "hyperopt_list_no_details",
|
||||
"export_csv"]
|
||||
|
||||
|
@@ -484,6 +484,18 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
type=float,
|
||||
metavar='FLOAT',
|
||||
),
|
||||
"hyperopt_list_min_objective": Arg(
|
||||
'--min-objective',
|
||||
help='Select epochs on above objective.',
|
||||
type=float,
|
||||
metavar='FLOAT',
|
||||
),
|
||||
"hyperopt_list_max_objective": Arg(
|
||||
'--max-objective',
|
||||
help='Select epochs on below objective.',
|
||||
type=float,
|
||||
metavar='FLOAT',
|
||||
),
|
||||
"hyperopt_list_no_details": Arg(
|
||||
'--no-details',
|
||||
help='Do not print best epoch details.',
|
||||
|
@@ -35,9 +35,16 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
|
||||
'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', None),
|
||||
'filter_max_avg_profit': config.get('hyperopt_list_max_avg_profit', None),
|
||||
'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', None),
|
||||
'filter_max_total_profit': config.get('hyperopt_list_max_total_profit', None)
|
||||
'filter_max_total_profit': config.get('hyperopt_list_max_total_profit', None),
|
||||
'filter_min_objective': config.get('hyperopt_list_min_objective', None),
|
||||
'filter_max_objective': config.get('hyperopt_list_max_objective', None)
|
||||
}
|
||||
|
||||
if filteroptions['filter_min_objective'] is not None:
|
||||
filteroptions['filter_min_objective'] = -filteroptions['filter_min_objective']
|
||||
if filteroptions['filter_max_objective'] is not None:
|
||||
filteroptions['filter_max_objective'] = -filteroptions['filter_max_objective']
|
||||
|
||||
trials_file = (config['user_data_dir'] /
|
||||
'hyperopt_results' / 'hyperopt_results.pickle')
|
||||
|
||||
@@ -92,9 +99,16 @@ def start_hyperopt_show(args: Dict[str, Any]) -> None:
|
||||
'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', None),
|
||||
'filter_max_avg_profit': config.get('hyperopt_list_max_avg_profit', None),
|
||||
'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', None),
|
||||
'filter_max_total_profit': config.get('hyperopt_list_max_total_profit', None)
|
||||
'filter_max_total_profit': config.get('hyperopt_list_max_total_profit', None),
|
||||
'filter_min_objective': config.get('hyperopt_list_min_objective', None),
|
||||
'filter_max_objective': config.get('hyperopt_list_max_objective', None)
|
||||
}
|
||||
|
||||
if filteroptions['filter_min_objective'] is not None:
|
||||
filteroptions['filter_min_objective'] = -filteroptions['filter_min_objective']
|
||||
if filteroptions['filter_max_objective'] is not None:
|
||||
filteroptions['filter_max_objective'] = -filteroptions['filter_max_objective']
|
||||
|
||||
# Previous evaluations
|
||||
trials = Hyperopt.load_previous_results(trials_file)
|
||||
total_epochs = len(trials)
|
||||
@@ -175,6 +189,20 @@ def _hyperopt_filter_trials(trials: List, filteroptions: dict) -> List:
|
||||
x for x in trials
|
||||
if x['results_metrics']['profit'] < filteroptions['filter_max_total_profit']
|
||||
]
|
||||
if filteroptions['filter_min_objective'] is not None:
|
||||
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
|
||||
# trials = [x for x in trials if x['loss'] != 20]
|
||||
trials = [
|
||||
x for x in trials
|
||||
if x['loss'] < filteroptions['filter_min_objective']
|
||||
]
|
||||
if filteroptions['filter_max_objective'] is not None:
|
||||
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
|
||||
# trials = [x for x in trials if x['loss'] != 20]
|
||||
trials = [
|
||||
x for x in trials
|
||||
if x['loss'] > filteroptions['filter_max_objective']
|
||||
]
|
||||
|
||||
logger.info(f"{len(trials)} " +
|
||||
("best " if filteroptions['only_best'] else "") +
|
||||
|
Reference in New Issue
Block a user