forked from kodorvan/stcs
Fixed get liq price function
This commit is contained in:
@@ -147,17 +147,12 @@ async def get_liquidation_price(
|
|||||||
maint_margin_rate = safe_float(risk_level.get("maintenanceMargin"))
|
maint_margin_rate = safe_float(risk_level.get("maintenanceMargin"))
|
||||||
maint_margin_deduction = safe_float(risk_level.get("initialMargin"))
|
maint_margin_deduction = safe_float(risk_level.get("initialMargin"))
|
||||||
max_leverage = safe_float(risk_level.get("maxLeverage"))
|
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
|
initial_margin = position_value / max_leverage
|
||||||
maint_margin = (position_value * maint_margin_rate) - maint_margin_deduction
|
maint_margin = (position_value * maint_margin_rate) - maint_margin_deduction
|
||||||
|
|
||||||
liq_price_long = order_quantity / (
|
liq_price_long = entry_price - (initial_margin - maint_margin) / order_quantity
|
||||||
position_value + (initial_margin - maint_margin)
|
liq_price_short = entry_price + (initial_margin - maint_margin) / order_quantity
|
||||||
)
|
|
||||||
|
|
||||||
liq_price_short = order_quantity / (
|
|
||||||
position_value - (initial_margin - maint_margin)
|
|
||||||
)
|
|
||||||
|
|
||||||
liq_price = liq_price_long, liq_price_short
|
liq_price = liq_price_long, liq_price_short
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user