Comment on page

# Liquidation

The price at which liquidation occurs is a function of asset qty [Q], PnL [E], collateral [C], closing + borrow fees [F], and a slippage risk factor [f] (1% for Crypto) which accounts for a built-in safety net to protect the protocol from losses on a position exceeding collateral.
In Short: If (collateral - losses - borrow fee) is less than 1% of your position's size. If the Asset price crosses this point then the position will be liquidated.
Allowed losses [A] on a position at which point the position is liquidated are determined by:
$A =C- (F+fQE)$
Likewise, the liquidation price [L] is calculated as follows:
$L=\begin{cases} E-\frac{A}{Q} &\text{if } LONG \\ E+\frac{A}{Q} &\text{if } SHORT\end{cases}$
If there is any collateral remaining after deducting losses and fees, then the corresponding amount would be returned to your account.
For example, assume a BTC/USD Long trade of qty 1.25 BTC using $1000 collateral with 20x leverage. The avg. entry price is 16,000 and total closing fees are$20. The corresponding liquidation price would be around 15,360. Besides the Palmswap team's liquidation wallet, it is also possible for anybody to trigger a liquidation. However, currently, 100% of the liquidations go to the PLP vault as a reward for providing liquidity.
Due to the borrow fee, your liquidation price will change over time, especially if you use leverage that is more than 10x and have the position open for more than a few days, so it is important to monitor your liquidation price.