nb_trades and avg_trade_duration added to cli

This commit is contained in:
misagh 2018-11-14 13:38:23 +01:00
parent ac0c931492
commit 36030176bb

View File

@ -53,19 +53,22 @@ class EdgeCli(object):
def _generate_edge_table(self, results: dict) -> str: def _generate_edge_table(self, results: dict) -> str:
floatfmt = ('s', '.2f', '.2f', '.2f', '.2f', '.2f') floatfmt = ('s', '.2f', '.2f', '.2f', '.2f', '.2f', 'd', '.d')
tabular_data = [] tabular_data = []
headers = ['pair', 'stoploss', 'win rate', 'risk reward ratio', headers = ['pair', 'stoploss', 'win rate', 'risk reward ratio',
'required risk reward', 'expectancy'] 'required risk reward', 'expectancy', 'total number of trades', 'average duration (min)']
for result in results.items(): for result in results.items():
if result[1].nb_trades > 0:
tabular_data.append([ tabular_data.append([
result[0], result[0],
result[1].stoploss, result[1].stoploss,
result[1].winrate, result[1].winrate,
result[1].risk_reward_ratio, result[1].risk_reward_ratio,
result[1].required_risk_reward, result[1].required_risk_reward,
result[1].expectancy result[1].expectancy,
result[1].nb_trades,
round(result[1].avg_trade_duration)
]) ])
return tabulate(tabular_data, headers=headers, floatfmt=floatfmt, tablefmt="pipe") return tabulate(tabular_data, headers=headers, floatfmt=floatfmt, tablefmt="pipe")