add --hyperopt-path option

This commit is contained in:
hroff-1902 2019-07-22 19:37:34 +03:00
parent 41f24898e5
commit 04382d4b44
4 changed files with 18 additions and 6 deletions

View File

@ -201,7 +201,8 @@ to find optimal parameter values for your stategy.
usage: freqtrade hyperopt [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE] usage: freqtrade hyperopt [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE]
[--max_open_trades INT] [--max_open_trades INT]
[--stake_amount STAKE_AMOUNT] [-r] [--stake_amount STAKE_AMOUNT] [-r]
[--customhyperopt NAME] [--eps] [-e INT] [--customhyperopt NAME] [--hyperopt-path PATH]
[--eps] [-e INT]
[-s {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...]] [-s {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...]]
[--dmmp] [--print-all] [-j JOBS] [--dmmp] [--print-all] [-j JOBS]
[--random-state INT] [--min-trades INT] [--continue] [--random-state INT] [--min-trades INT] [--continue]
@ -225,6 +226,8 @@ optional arguments:
--customhyperopt NAME --customhyperopt NAME
Specify hyperopt class name (default: Specify hyperopt class name (default:
`DefaultHyperOpts`). `DefaultHyperOpts`).
--hyperopt-path PATH Specify additional lookup path for Hyperopts and
Hyperopt Loss functions.
--eps, --enable-position-stacking --eps, --enable-position-stacking
Allow buying the same pair multiple times (position Allow buying the same pair multiple times (position
stacking). stacking).

View File

@ -168,6 +168,11 @@ AVAILABLE_CLI_OPTIONS = {
metavar='NAME', metavar='NAME',
default=constants.DEFAULT_HYPEROPT, default=constants.DEFAULT_HYPEROPT,
), ),
"hyperopt_path": Arg(
'--hyperopt-path',
help='Specify additional lookup path for Hyperopts and Hyperopt Loss functions.',
metavar='PATH',
),
"epochs": Arg( "epochs": Arg(
'-e', '--epochs', '-e', '--epochs',
help='Specify number of epochs (default: %(default)d).', help='Specify number of epochs (default: %(default)d).',
@ -312,7 +317,8 @@ ARGS_COMMON_OPTIMIZE = ["ticker_interval", "timerange",
ARGS_BACKTEST = ARGS_COMMON_OPTIMIZE + ["position_stacking", "use_max_market_positions", ARGS_BACKTEST = ARGS_COMMON_OPTIMIZE + ["position_stacking", "use_max_market_positions",
"live", "strategy_list", "export", "exportfilename"] "live", "strategy_list", "export", "exportfilename"]
ARGS_HYPEROPT = ARGS_COMMON_OPTIMIZE + ["hyperopt", "position_stacking", "epochs", "spaces", ARGS_HYPEROPT = ARGS_COMMON_OPTIMIZE + ["hyperopt", "hyperopt_path",
"position_stacking", "epochs", "spaces",
"use_max_market_positions", "print_all", "hyperopt_jobs", "use_max_market_positions", "print_all", "hyperopt_jobs",
"hyperopt_random_state", "hyperopt_min_trades", "hyperopt_random_state", "hyperopt_min_trades",
"hyperopt_continue", "hyperopt_loss"] "hyperopt_continue", "hyperopt_loss"]

View File

@ -129,8 +129,8 @@ class Configuration(object):
if self.args.strategy != constants.DEFAULT_STRATEGY or not config.get('strategy'): if self.args.strategy != constants.DEFAULT_STRATEGY or not config.get('strategy'):
config.update({'strategy': self.args.strategy}) config.update({'strategy': self.args.strategy})
if self.args.strategy_path: self._args_to_config(config, argname='strategy_path',
config.update({'strategy_path': self.args.strategy_path}) logstring='Using additional Strategy lookup path: {}')
def _process_common_options(self, config: Dict[str, Any]) -> None: def _process_common_options(self, config: Dict[str, Any]) -> None:
@ -239,6 +239,9 @@ class Configuration(object):
self._args_to_config(config, argname='hyperopt', self._args_to_config(config, argname='hyperopt',
logstring='Using Hyperopt file {}') logstring='Using Hyperopt file {}')
self._args_to_config(config, argname='hyperopt_path',
logstring='Using additional Hyperopt lookup path: {}')
self._args_to_config(config, argname='epochs', self._args_to_config(config, argname='epochs',
logstring='Parameter --epochs detected ... ' logstring='Parameter --epochs detected ... '
'Will run Hyperopt with for {} epochs ...' 'Will run Hyperopt with for {} epochs ...'

View File

@ -60,7 +60,7 @@ class HyperOptResolver(IResolver):
if extra_dir: if extra_dir:
# Add extra hyperopt directory on top of search paths # Add extra hyperopt directory on top of search paths
abs_paths.insert(0, Path(extra_dir)) abs_paths.insert(0, Path(extra_dir).resolve())
hyperopt = self._load_object(paths=abs_paths, object_type=IHyperOpt, hyperopt = self._load_object(paths=abs_paths, object_type=IHyperOpt,
object_name=hyperopt_name) object_name=hyperopt_name)
@ -115,7 +115,7 @@ class HyperOptLossResolver(IResolver):
if extra_dir: if extra_dir:
# Add extra hyperopt directory on top of search paths # Add extra hyperopt directory on top of search paths
abs_paths.insert(0, Path(extra_dir)) abs_paths.insert(0, Path(extra_dir).resolve())
hyperoptloss = self._load_object(paths=abs_paths, object_type=IHyperOptLoss, hyperoptloss = self._load_object(paths=abs_paths, object_type=IHyperOptLoss,
object_name=hyper_loss_name) object_name=hyper_loss_name)