Merge pull request #1788 from hroff-1902/hyperopt-print-all

--print-all command line option for hyperopt
This commit is contained in:
Matthias 2019-04-22 13:14:46 +02:00 committed by GitHub
commit 86ec88b8fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -283,7 +283,6 @@ class Arguments(object):
dest='position_stacking', dest='position_stacking',
default=False default=False
) )
parser.add_argument( parser.add_argument(
'--dmmp', '--disable-max-market-positions', '--dmmp', '--disable-max-market-positions',
help='Disable applying `max_open_trades` during backtest ' help='Disable applying `max_open_trades` during backtest '
@ -309,6 +308,13 @@ class Arguments(object):
nargs='+', nargs='+',
dest='spaces', dest='spaces',
) )
parser.add_argument(
'--print-all',
help='Print all results, not only the best ones.',
action='store_true',
dest='print_all',
default=False
)
def _build_subcommands(self) -> None: def _build_subcommands(self) -> None:
""" """

View File

@ -320,6 +320,10 @@ class Configuration(object):
config.update({'spaces': self.args.spaces}) config.update({'spaces': self.args.spaces})
logger.info('Parameter -s/--spaces detected: %s', config.get('spaces')) logger.info('Parameter -s/--spaces detected: %s', config.get('spaces'))
if 'print_all' in self.args and self.args.print_all:
config.update({'print_all': self.args.print_all})
logger.info('Parameter --print-all detected: %s', config.get('print_all'))
return config return config
def _validate_config_schema(self, conf: Dict[str, Any]) -> Dict[str, Any]: def _validate_config_schema(self, conf: Dict[str, Any]) -> Dict[str, Any]:

View File

@ -115,7 +115,7 @@ class Hyperopt(Backtesting):
""" """
Log results if it is better than any previous evaluation Log results if it is better than any previous evaluation
""" """
if results['loss'] < self.current_best_loss: if self.config.get('print_all', False) or results['loss'] < self.current_best_loss:
current = results['current_tries'] current = results['current_tries']
total = results['total_tries'] total = results['total_tries']
res = results['result'] res = results['result']