Merge pull request #1738 from konqueror1/develop
Added command line options to override max_open_trades and stake_amount
This commit is contained in:
commit
12265b245d
@ -247,6 +247,22 @@ class Arguments(object):
|
|||||||
dest='timerange',
|
dest='timerange',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--max_open_trades',
|
||||||
|
help='Specify max_open_trades to use.',
|
||||||
|
default=None,
|
||||||
|
type=int,
|
||||||
|
dest='max_open_trades',
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--stake_amount',
|
||||||
|
help='Specify stake_amount.',
|
||||||
|
default=None,
|
||||||
|
type=float,
|
||||||
|
dest='stake_amount',
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def hyperopt_options(parser: argparse.ArgumentParser) -> None:
|
def hyperopt_options(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -194,7 +194,7 @@ class Configuration(object):
|
|||||||
logger.info(f'Created data directory: {datadir}')
|
logger.info(f'Created data directory: {datadir}')
|
||||||
return datadir
|
return datadir
|
||||||
|
|
||||||
def _load_backtesting_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
|
def _load_backtesting_config(self, config: Dict[str, Any]) -> Dict[str, Any]: # noqa: C901
|
||||||
"""
|
"""
|
||||||
Extract information for sys.argv and load Backtesting configuration
|
Extract information for sys.argv and load Backtesting configuration
|
||||||
:return: configuration as dictionary
|
:return: configuration as dictionary
|
||||||
@ -217,14 +217,24 @@ class Configuration(object):
|
|||||||
config.update({'position_stacking': True})
|
config.update({'position_stacking': True})
|
||||||
logger.info('Parameter --enable-position-stacking detected ...')
|
logger.info('Parameter --enable-position-stacking detected ...')
|
||||||
|
|
||||||
# If --disable-max-market-positions is used we add it to the configuration
|
# If --disable-max-market-positions or --max_open_trades is used we update configuration
|
||||||
if 'use_max_market_positions' in self.args and not self.args.use_max_market_positions:
|
if 'use_max_market_positions' in self.args and not self.args.use_max_market_positions:
|
||||||
config.update({'use_max_market_positions': False})
|
config.update({'use_max_market_positions': False})
|
||||||
logger.info('Parameter --disable-max-market-positions detected ...')
|
logger.info('Parameter --disable-max-market-positions detected ...')
|
||||||
logger.info('max_open_trades set to unlimited ...')
|
logger.info('max_open_trades set to unlimited ...')
|
||||||
|
elif 'max_open_trades' in self.args and self.args.max_open_trades:
|
||||||
|
config.update({'max_open_trades': self.args.max_open_trades})
|
||||||
|
logger.info('Parameter --max_open_trades detected, '
|
||||||
|
'overriding max_open_trades to: %s ...', config.get('max_open_trades'))
|
||||||
else:
|
else:
|
||||||
logger.info('Using max_open_trades: %s ...', config.get('max_open_trades'))
|
logger.info('Using max_open_trades: %s ...', config.get('max_open_trades'))
|
||||||
|
|
||||||
|
# If --stake_amount is used we update configuration
|
||||||
|
if 'stake_amount' in self.args and self.args.stake_amount:
|
||||||
|
config.update({'stake_amount': self.args.stake_amount})
|
||||||
|
logger.info('Parameter --stake_amount detected, overriding stake_amount to: %s ...',
|
||||||
|
config.get('stake_amount'))
|
||||||
|
|
||||||
# If --timerange is used we add it to the configuration
|
# If --timerange is used we add it to the configuration
|
||||||
if 'timerange' in self.args and self.args.timerange:
|
if 'timerange' in self.args and self.args.timerange:
|
||||||
config.update({'timerange': self.args.timerange})
|
config.update({'timerange': self.args.timerange})
|
||||||
|
Loading…
Reference in New Issue
Block a user