--print-all command line option added for hyperopt

This commit is contained in:
hroff-1902 2019-04-22 01:10:01 +03:00
parent ccc91403c5
commit 6b87d94bb0
3 changed files with 12 additions and 2 deletions

View File

@ -283,7 +283,6 @@ class Arguments(object):
dest='position_stacking',
default=False
)
parser.add_argument(
'--dmmp', '--disable-max-market-positions',
help='Disable applying `max_open_trades` during backtest '
@ -309,6 +308,13 @@ class Arguments(object):
nargs='+',
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:
"""

View File

@ -320,6 +320,10 @@ class Configuration(object):
config.update({'spaces': self.args.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
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
"""
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']
total = results['total_tries']
res = results['result']