Also print trade_duration in seconds to json

This commit is contained in:
Matthias
2021-01-24 20:09:18 +01:00
parent 62e43539c9
commit c659150d9f
5 changed files with 10 additions and 4 deletions

View File

@@ -302,9 +302,11 @@ class Trade(_DECL_BASE):
'close_profit_pct': round(self.close_profit * 100, 2) if self.close_profit else None,
'close_profit_abs': self.close_profit_abs, # Deprecated
# TODO: should this be in minutes or seconds??
'trade_duration_s': (int((self.close_date - self.open_date).total_seconds())
if self.close_date else None),
'trade_duration': (int((self.close_date - self.open_date).total_seconds() // 60)
if self.close_date else None),
'profit_ratio': self.close_profit,
'profit_pct': round(self.close_profit * 100, 2) if self.close_profit else None,
'profit_abs': self.close_profit_abs,