Disable Defaulting to DefaultStrategy
This commit is contained in:
@@ -66,9 +66,8 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
# Main options
|
||||
"strategy": Arg(
|
||||
'-s', '--strategy',
|
||||
help='Specify strategy class name (default: `%(default)s`).',
|
||||
help='Specify strategy class name which will be used by the bot.',
|
||||
metavar='NAME',
|
||||
default='DefaultStrategy',
|
||||
),
|
||||
"strategy_path": Arg(
|
||||
'--strategy-path',
|
||||
|
@@ -128,7 +128,7 @@ class Configuration:
|
||||
self._process_logging_options(config)
|
||||
|
||||
# Set strategy if not specified in config and or if it's non default
|
||||
if self.args.get("strategy") != constants.DEFAULT_STRATEGY or not config.get('strategy'):
|
||||
if self.args.get("strategy") or not config.get('strategy'):
|
||||
config.update({'strategy': self.args.get("strategy")})
|
||||
|
||||
self._args_to_config(config, argname='strategy_path',
|
||||
|
@@ -9,7 +9,6 @@ PROCESS_THROTTLE_SECS = 5 # sec
|
||||
DEFAULT_TICKER_INTERVAL = 5 # min
|
||||
HYPEROPT_EPOCH = 100 # epochs
|
||||
RETRY_TIMEOUT = 30 # sec
|
||||
DEFAULT_STRATEGY = 'DefaultStrategy'
|
||||
DEFAULT_HYPEROPT = 'DefaultHyperOpts'
|
||||
DEFAULT_HYPEROPT_LOSS = 'DefaultHyperOptLoss'
|
||||
DEFAULT_DB_PROD_URL = 'sqlite:///tradesv3.sqlite'
|
||||
|
@@ -32,8 +32,11 @@ class StrategyResolver(IResolver):
|
||||
"""
|
||||
config = config or {}
|
||||
|
||||
# Verify the strategy is in the configuration, otherwise fallback to the default strategy
|
||||
strategy_name = config.get('strategy') or constants.DEFAULT_STRATEGY
|
||||
if not config.get('strategy'):
|
||||
raise OperationalException("No strategy set. Please use `--strategy` to specify "
|
||||
"the strategy class to use.")
|
||||
|
||||
strategy_name = config['strategy']
|
||||
self.strategy: IStrategy = self._load_strategy(strategy_name,
|
||||
config=config,
|
||||
extra_dir=config.get('strategy_path'))
|
||||
|
Reference in New Issue
Block a user