Simplify trade_statistics

This commit is contained in:
Matthias
2024-04-20 10:30:04 +02:00
parent b9b044585d
commit 608088bc03

View File

@@ -462,8 +462,9 @@ class RPC:
self, stake_currency: str, fiat_display_currency: str,
start_date: Optional[datetime] = None) -> Dict[str, Any]:
""" Returns cumulative profit statistics """
if start_date is None:
start_date = datetime.fromtimestamp(0)
start_date = datetime.fromtimestamp(0) if start_date is None else start_date
trade_filter = ((Trade.is_open.is_(False) & (Trade.close_date >= start_date)) |
Trade.is_open.is_(True))
trades: Sequence[Trade] = Trade.session.scalars(Trade.get_trades_query(