From a1a7355dc301509f42900b6a0904cd5178ebc6a0 Mon Sep 17 00:00:00 2001 From: algizn97 Date: Thu, 2 Oct 2025 15:27:33 +0500 Subject: [PATCH] Fixed get liq price function --- app/helper_functions.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/helper_functions.py b/app/helper_functions.py index 0b70960..e2c38c7 100644 --- a/app/helper_functions.py +++ b/app/helper_functions.py @@ -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