# Position liquidation

Last updated

Last updated

The liquidation of a position on Gravix occurs automatically. It happens when a trader reaches losses in the amount of -90% of the initial collateral. In this case, the system closes the position and receives the collateral.

2% of the initial collateral is used to pay for the services of a *position liquidator bot*. It closes the position and ensures market stability.

The liquidation price of a position changes dynamically and depends on borrowing rates and funding fees. In addition, the liquidation price may be affected by external factors, such as a significant change in the underlying asset price. The formula for calculating the distance to liquidation is based on several factors: the open position, collateral, borrowing rate and financing fee. The distance to liquidation shows how close the trader is to losing their position.

For both long and short positions, the formula for calculating the liquidation price takes into account the distance to liquidation, the open price and the base spread.

The formulas below permit traders to assess the risks and take appropriate measures to avoid the liquidation of their positions.

The formula for calculating the distance to liquidation:

$Liquidation\,Price\,Distance = \\ = \cfrac {Open\,Price * (Collateral * 0.9 - Borrow\,rate - Funding\,fees)} {Collateral * Leverage}$

Where:

**Liquidation Price Distance**- the distance between the current price and the liquidation price of the position. It is used to determine when the position will be liquidated**Open Price**- the price at which the position was opened**Collateral**- the amount a trader uses to open a position without taking leverage into account**Borrowing rate**-the interest rate that the trader pays for using borrowed funds**Funding fee**- a fee that some traders pay to others depending on the change in the price of an asset**Leverage**- a multiplier indicating how much a trader's position is increased relative to their collateral

The formula for calculating the liquidation price of a long position:

$Liquidation\,price = \cfrac {Open\,price - Liquidation\,Price\,Distance}{1-Close\,spread}$

Where:

**Liquidation Price**- the price at which the position will be liquidated**Open Price**- the price at which the position was opened**Liquidation Price Distance**- the distance between the current price and the liquidation price of the position, which was calculated in the previous formula.**Close spread**- the difference between the sale price and the purchase price, which is taken into account when closing a position

The formula for calculating the liquidation price of a short position:

Where:

**Liquidation Price**- the price at which the position will be liquidated**Open Price**- the price at which the position was opened**Liquidation Price Distance**- the distance between the current price and the liquidation price of the position, which was calculated in the previous formula**Close spread**- the difference between the sale price and the purchase price, which is taken into account when closing a position

$Liquidation\,price = \cfrac {Open\,price + Liquidation\,Price\,Distance}{1+Close\,spread}$