fix: Calculate liquidation price only once the initial order filled

closes #11318
This commit is contained in:
Matthias
2025-02-05 18:13:52 +01:00
parent dbb9f225d0
commit b75eb85e66
+13 -12
View File
@@ -35,19 +35,20 @@ def update_liquidation_prices(
open_trades: list[Trade] = Trade.get_open_trades() open_trades: list[Trade] = Trade.get_open_trades()
for t in open_trades: for t in open_trades:
# TODO: This should be done in a batch update if t.has_open_position:
t.set_liquidation_price( # TODO: This should be done in a batch update
exchange.get_liquidation_price( t.set_liquidation_price(
pair=t.pair, exchange.get_liquidation_price(
open_rate=t.open_rate, pair=t.pair,
is_short=t.is_short, open_rate=t.open_rate,
amount=t.amount, is_short=t.is_short,
stake_amount=t.stake_amount, amount=t.amount,
leverage=t.leverage, stake_amount=t.stake_amount,
wallet_balance=total_wallet_stake, leverage=t.leverage,
open_trades=open_trades, wallet_balance=total_wallet_stake,
open_trades=open_trades,
)
) )
)
elif trade: elif trade:
trade.set_liquidation_price( trade.set_liquidation_price(
exchange.get_liquidation_price( exchange.get_liquidation_price(