mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add hyperopt option to clean temporary pickle files
This commit is contained in:
parent
5144e98a82
commit
107f00ff8f
|
@ -223,6 +223,13 @@ AVAILABLE_CLI_OPTIONS = {
|
|||
metavar='INT',
|
||||
default=1,
|
||||
),
|
||||
"hyperopt_clean_state": Arg(
|
||||
"--clean",
|
||||
help="Remove temporary hyperopt files (should be used when the custom hyperopt file "
|
||||
"was changed, or when changing the arguments for --min-trades or spaces.",
|
||||
default=False,
|
||||
action='store_true',
|
||||
),
|
||||
# List exchanges
|
||||
"print_one_column": Arg(
|
||||
'-1', '--one-column',
|
||||
|
@ -309,7 +316,8 @@ ARGS_BACKTEST = ARGS_COMMON_OPTIMIZE + ["position_stacking", "use_max_market_pos
|
|||
|
||||
ARGS_HYPEROPT = ARGS_COMMON_OPTIMIZE + ["hyperopt", "position_stacking", "epochs", "spaces",
|
||||
"use_max_market_positions", "print_all", "hyperopt_jobs",
|
||||
"hyperopt_random_state", "hyperopt_min_trades"]
|
||||
"hyperopt_random_state", "hyperopt_min_trades",
|
||||
"hyperopt_clean_state"]
|
||||
|
||||
ARGS_EDGE = ARGS_COMMON_OPTIMIZE + ["stoploss_range"]
|
||||
|
||||
|
|
|
@ -284,6 +284,8 @@ class Configuration(object):
|
|||
|
||||
self._args_to_config(config, argname='hyperopt_min_trades',
|
||||
logstring='Parameter --min-trades detected: {}')
|
||||
self._args_to_config(config, argname='hyperopt_clean_state',
|
||||
logstring='Removing hyperopt temp files')
|
||||
|
||||
return config
|
||||
|
||||
|
|
|
@ -63,10 +63,22 @@ class Hyperopt(Backtesting):
|
|||
# Note, this is ratio. 3.85 stated above means 385Σ%.
|
||||
self.expected_max_profit = 3.0
|
||||
|
||||
if self.config['hyperopt_clean_state']:
|
||||
self.clean_hyperopt()
|
||||
# Previous evaluations
|
||||
self.trials_file = TRIALSDATA_PICKLE
|
||||
self.trials: List = []
|
||||
|
||||
def clean_hyperopt(self):
|
||||
"""
|
||||
Remove hyperopt pickle files to restart hyperopt.
|
||||
"""
|
||||
for f in [TICKERDATA_PICKLE, TRIALSDATA_PICKLE]:
|
||||
p = Path(f)
|
||||
if p.is_file():
|
||||
logger.info(f"Removing `{p}`.")
|
||||
p.unlink()
|
||||
|
||||
def get_args(self, params):
|
||||
dimensions = self.hyperopt_space()
|
||||
# Ensure the number of dimensions match
|
||||
|
|
Loading…
Reference in New Issue
Block a user