Twilight
Search…
Liquidation
Liquidation happens when the position hits the liquidation price or the available margin drops below the maintenance margin. Solvency check for every position happens every hour when the funding is charged.
Similar to other crypto exchange's liquidation engines , liquidation price depends on the bankruptcy price, which is also used to calculate the maintenance margin.
Bankruptcy Price:
    For Long positions
      bankruptcyPrice=entryPriceleverageleverage+1bankruptcyPrice=entryPrice*\frac{leverage}{leverage+1}
    For Short positions
      bankruptcyPrice=entryPriceleverageleverage1bankruptcyPrice= entryPrice*\frac{leverage}{leverage-1}
Above does not hold true for 1x short position, for which both bankruptcyPrice and liquidationPrice are not calculated
Bankruptcy Value:
    bankruptcyValue=PositionSize(1bankruptcyPrice)bankruptcyValue=PositionSize*(\frac{1}{bankruptcyPrice})
Maintenance Margin:
    MM=(0.4%entryValue)+(fee%bankruptcyValue)+(funding%bankruptcyValue)MM= (0.4\%*entryValue)+(fee\%*bankruptcyValue)+(funding\%*bankruptcyValue)
Liquidation Price:
LP=entryPricepositionSize(positionSideentryPrice)(MMinitialMargin)+positionSizeLP=\frac{entryPrice*positionSize}{(positionSide*entryPrice)*(MM-initialMargin)+positionSize}
    For positionSide, Use +1 for Short Use -1 for Long
Last modified 1yr ago
Copy link