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