Add trading-volume to api schema

This commit is contained in:
Matthias
2022-06-18 16:53:25 +02:00
parent 474e6705e6
commit 0168343b76
5 changed files with 23 additions and 7 deletions

View File

@@ -1363,8 +1363,7 @@ class Trade(_DECL_BASE, LocalTrade):
trading_volume = Order.query.with_entities(
func.sum(Order.cost).label('volume')
).filter(
(Order.order_filled_date >= start_date)
& (Order.status == 'closed')
) \
.scalar()
Order.order_filled_date >= start_date,
Order.status == 'closed'
).scalar()
return trading_volume

View File

@@ -107,6 +107,7 @@ class Profit(BaseModel):
profit_factor: float
max_drawdown: float
max_drawdown_abs: float
trading_volume: Optional[float]
class SellReason(BaseModel):