Fixed get liq price function

This commit is contained in:
algizn97
2025-10-02 15:27:33 +05:00
parent 9d2b049e56
commit a1a7355dc3

View File

@@ -147,17 +147,12 @@ async def get_liquidation_price(
maint_margin_rate = safe_float(risk_level.get("maintenanceMargin"))
maint_margin_deduction = safe_float(risk_level.get("initialMargin"))
max_leverage = safe_float(risk_level.get("maxLeverage"))
position_value = order_quantity / entry_price
position_value = order_quantity * entry_price
initial_margin = position_value / max_leverage
maint_margin = (position_value * maint_margin_rate) - maint_margin_deduction
liq_price_long = order_quantity / (
position_value + (initial_margin - maint_margin)
)
liq_price_short = order_quantity / (
position_value - (initial_margin - maint_margin)
)
liq_price_long = entry_price - (initial_margin - maint_margin) / order_quantity
liq_price_short = entry_price + (initial_margin - maint_margin) / order_quantity
liq_price = liq_price_long, liq_price_short