## Liquidation

The price at which liquidation occurs is a function of asset qty [Q], avg entry price [E], collateral [C], closing + funding fees [F], and a slippage risk factor [f] (1% for non-Forex assets and 0.3% for Forex assets) which accounts for a built-in safety net to protect the protocol from losses on a position exceeding collateral.
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 liquidated, the trader will be returned a portion of their collateral based on the slippage [S] which represents the difference between
$L$
and the price at which the position actually gets liquidated. The collateral returned
$C_R$
$C_R = Q(fE-S)$
For example, assume a BTC/USD Long trade of qty 1.25 BTC using $1000 collateral. The avg entry price is 16,000 and total closing fees are$20. The corresponding liquidation price is 15,376; however, due to rapid price decline near liquidation price, the position isn't forced closed until a price of 15,350 resulting in a slippage of 26.00. In this case, a total of \$167.50 would be returned to the trader.
Notice in the example above, a slippage of up to
$fE=160.00$
could be absorbed without the protocol (VLP Vault) suffering any losses. Besides the Vela team's liquidation wallet, it is also possible for anybody to trigger a liquidation. However, currently 100% of the liquidations goes to the VLP vault as a reward for providing the liquidity.

## Open Interest Limits

Open Interest (OI) limits for both Longs and Shorts are established to protect the protocol from total OI exceeding TVL (in this case VLP backed liquidity). These limits, for each tradable asset, are based on a percentage of TVL at both the user and asset level. The starting default rates are shown in the table below. These rates may change in the future as risk profiles vary by asset.
Asset
WBTC/USD
Per User (long/short)
1.0%/1.0%
Per Asset (long/short)
15.0%/15.0%
Asset
WETH/USD
Per User (long/short)
0.75%/0.75%
Per Asset (long/short)
15.0%/15.0%
Asset
DOGE/USD
Per User (long/short)
0.25%/0.25%
Per Asset (long/short)
2.5%/2.5%
Asset
SHIB/USD
Per User (long/short)
0.25%/0.25%
Per Asset (long/short)
2.5%/2.5%
Asset
EUR/USD
Per User (long/short)
1.0%/1.0%
Per Asset (long/short)
10.0%/10.0%
Asset
USDC MCAP
Per User (long/short)
0.5%/0.5%
Per Asset (long/short)
5.0%/5.0%

## Funding Rate

A funding rate
$R$
is put in place for each side of each asset to incentivize traders to keep the total position size from diverging significantly with traders total collateral, thus providing further risk mitigation measures for the protocol. Funding rate is dynamically updated for each asset every funding interval (1 hour) and calculated as follows:
$R=k\left(\dfrac{Open Position Size}{Open CollateralSize}\right)$
$k$
is a parameter that is a function of each assets historical volatility and is updated regularly as market conditions change.
The funding fees
$F_f$
are paid out upon closing the position. They are calculated based on ones position size
$P$
at the start of each funding interval and how many hours
$t$
the position has been opened, rounded up.
$F_f=\sum_{i=1}^tP_iR_i$