feat: have performance account for leverage correctly

This commit is contained in:
Matthias
2025-01-19 13:57:00 +01:00
parent 1e2450d5b9
commit 141286a88c

View File

@@ -1939,8 +1939,11 @@ class Trade(ModelBase, LocalTrade):
select(
Trade.pair,
func.sum(
func.coalesce(Order.filled, Order.amount)
* func.coalesce(Order.average, Order.price, Order.ft_price)
(
func.coalesce(Order.filled, Order.amount)
* func.coalesce(Order.average, Order.price, Order.ft_price)
)
/ func.coalesce(Trade.leverage, 1)
).label("cost_per_pair"),
)
.join(Order, Trade.id == Order.ft_trade_id)