create and use hyperopt-results folder
This commit is contained in:
parent
5d22d541f2
commit
8cef567abc
@ -97,6 +97,7 @@ user_data/
|
|||||||
├── backtest_results
|
├── backtest_results
|
||||||
├── data
|
├── data
|
||||||
├── hyperopts
|
├── hyperopts
|
||||||
|
├── hyperopts_results
|
||||||
├── plot
|
├── plot
|
||||||
└── strategies
|
└── strategies
|
||||||
```
|
```
|
||||||
|
@ -21,7 +21,7 @@ def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> str
|
|||||||
|
|
||||||
|
|
||||||
def create_userdata_dir(directory: str) -> Path:
|
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)
|
folder = Path(directory)
|
||||||
if not folder.is_dir():
|
if not folder.is_dir():
|
||||||
folder.mkdir(parents=True)
|
folder.mkdir(parents=True)
|
||||||
|
@ -47,8 +47,10 @@ class Hyperopt(Backtesting):
|
|||||||
self.custom_hyperoptloss = HyperOptLossResolver(self.config).hyperoptloss
|
self.custom_hyperoptloss = HyperOptLossResolver(self.config).hyperoptloss
|
||||||
self.calculate_loss = self.custom_hyperoptloss.hyperopt_loss_function
|
self.calculate_loss = self.custom_hyperoptloss.hyperopt_loss_function
|
||||||
|
|
||||||
self.trials_file = self.config['user_data_dir'] / 'hyperopt_results.pickle'
|
self.trials_file = (self.config['user_data_dir'] /
|
||||||
self.tickerdata_pickle = self.config['user_data_dir'] / 'hyperopt_tickerdata.pkl'
|
'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.total_tries = config.get('epochs', 0)
|
||||||
self.current_best_loss = 100
|
self.current_best_loss = 100
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ def test_create_userdata_dir(mocker, default_conf, caplog) -> None:
|
|||||||
md = mocker.patch.object(Path, 'mkdir', MagicMock())
|
md = mocker.patch.object(Path, 'mkdir', MagicMock())
|
||||||
|
|
||||||
x = create_userdata_dir('/tmp/bar')
|
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 md.call_args[1]['parents'] is False
|
||||||
assert log_has('Created user-data directory: /tmp/bar', caplog.record_tuples)
|
assert log_has('Created user-data directory: /tmp/bar', caplog.record_tuples)
|
||||||
assert isinstance(x, Path)
|
assert isinstance(x, Path)
|
||||||
|
Loading…
Reference in New Issue
Block a user