stop loss range added to args

This commit is contained in:
misagh 2018-11-14 16:31:23 +01:00
parent 36030176bb
commit b0e4aa8eff
3 changed files with 16 additions and 1 deletions

View File

@ -199,6 +199,13 @@ class Arguments(object):
action='store_true',
dest='refresh_pairs',
)
parser.add_argument(
'--stoplosses',
help='defines a range of stoploss against which edge will assess the strategy'
'the format is "min, max, step". example: -0.01, -0.1, -0.001',
type=str,
dest='stoploss_range',
)
parser.add_argument(
'--export',
help='export backtest results, argument are: trades\

View File

@ -227,6 +227,14 @@ class Configuration(object):
config.update({'timerange': self.args.timerange})
logger.info('Parameter --timerange detected: %s ...', self.args.timerange)
# If --timerange is used we add it to the configuration
if 'stoploss_range' in self.args and self.args.stoploss_range:
txt_range = eval(self.args.stoploss_range)
config['edge'].update({'stoploss_range_min': txt_range[0]})
config['edge'].update({'stoploss_range_max': txt_range[1]})
config['edge'].update({'stoploss_range_step': txt_range[2]})
logger.info('Parameter --stoplosses detected: %s ...', self.args.stoploss_range)
# If --datadir is used we add it to the configuration
if 'datadir' in self.args and self.args.datadir:
config.update({'datadir': self.args.datadir})

View File

@ -53,7 +53,7 @@ class EdgeCli(object):
def _generate_edge_table(self, results: dict) -> str:
floatfmt = ('s', '.2f', '.2f', '.2f', '.2f', '.2f', 'd', '.d')
floatfmt = ('s', '.10g', '.2f', '.2f', '.2f', '.2f', 'd', '.d')
tabular_data = []
headers = ['pair', 'stoploss', 'win rate', 'risk reward ratio',
'required risk reward', 'expectancy', 'total number of trades', 'average duration (min)']