Add hyperopt option to clean temporary pickle files

This commit is contained in:
Matthias
2019-07-15 20:17:15 +02:00
parent 5144e98a82
commit 107f00ff8f
3 changed files with 23 additions and 1 deletions

View File

@@ -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