create and use hyperopt-results folder

This commit is contained in:
Matthias 2019-07-31 07:07:46 +02:00
parent 5d22d541f2
commit 8cef567abc
4 changed files with 7 additions and 4 deletions

View File

@ -97,6 +97,7 @@ user_data/
├── backtest_results
├── data
├── hyperopts
├── hyperopts_results
├── plot
└── strategies
```

View File

@ -21,7 +21,7 @@ def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> str
def create_userdata_dir(directory: str) -> Path:
sub_dirs = ["backtest_results", "data", "hyperopts", "plot", "strategies", ]
sub_dirs = ["backtest_results", "data", "hyperopts", "hyperopt_results", "plot", "strategies", ]
folder = Path(directory)
if not folder.is_dir():
folder.mkdir(parents=True)

View File

@ -47,8 +47,10 @@ class Hyperopt(Backtesting):
self.custom_hyperoptloss = HyperOptLossResolver(self.config).hyperoptloss
self.calculate_loss = self.custom_hyperoptloss.hyperopt_loss_function
self.trials_file = self.config['user_data_dir'] / 'hyperopt_results.pickle'
self.tickerdata_pickle = self.config['user_data_dir'] / 'hyperopt_tickerdata.pkl'
self.trials_file = (self.config['user_data_dir'] /
'hyperopt_results' / 'hyperopt_results.pickle')
self.tickerdata_pickle = (self.config['user_data_dir'] /
'hyperopt_results' / 'hyperopt_tickerdata.pkl')
self.total_tries = config.get('epochs', 0)
self.current_best_loss = 100

View File

@ -626,7 +626,7 @@ def test_create_userdata_dir(mocker, default_conf, caplog) -> None:
md = mocker.patch.object(Path, 'mkdir', MagicMock())
x = create_userdata_dir('/tmp/bar')
assert md.call_count == 6
assert md.call_count == 7
assert md.call_args[1]['parents'] is False
assert log_has('Created user-data directory: /tmp/bar', caplog.record_tuples)
assert isinstance(x, Path)