LTV = Debt / Position Value
borrowed amount = debt
in calculations.
has_been_partially_liquidated
.
Initial State:
has_been_partially_liquidated = false
partial_threshold = 80 %
full_threshold = 90 %
safe_threshold = 70 %
Condition | Action |
---|---|
LTV ≥ partial_threshold and has_been_partially_liquidated = false | → Do partial liquidation (e.g. 50 %), then set has_been_partially_liquidated = true |
LTV ≥ full_threshold and has_been_partially_liquidated = true | → Fully liquidate the remaining position |
LTV < safe_threshold (e.g. user tops up collateral) | → Reset has_been_partially_liquidated = false |
i
with current debt Debtᵢ
:
percentage_to_repay = ΔB / B
Debtᵢ_new = Debtᵢ − liquidateᵢ