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

View File

@@ -35,19 +35,20 @@ def update_liquidation_prices(
open_trades: list[Trade] = Trade.get_open_trades()
for t in open_trades:
# TODO: This should be done in a batch update
t.set_liquidation_price(
exchange.get_liquidation_price(
pair=t.pair,
open_rate=t.open_rate,
is_short=t.is_short,
amount=t.amount,
stake_amount=t.stake_amount,
leverage=t.leverage,
wallet_balance=total_wallet_stake,
open_trades=open_trades,
if t.has_open_position:
# TODO: This should be done in a batch update
t.set_liquidation_price(
exchange.get_liquidation_price(
pair=t.pair,
open_rate=t.open_rate,
is_short=t.is_short,
amount=t.amount,
stake_amount=t.stake_amount,
leverage=t.leverage,
wallet_balance=total_wallet_stake,
open_trades=open_trades,
)
)
)
elif trade:
trade.set_liquidation_price(
exchange.get_liquidation_price(