# Overview

## Margin System

You can have a maximum of one active position per market and per collateral. For example, you can have one ETH-margined position and another USDC-collateralized position on the same market, but you can't have two USDC-margined positions on the same market.

Each position has its own margin and leverage that you can adjust independently from other positions. One position's profit or loss does not affect your other positions.

## Profit and Loss

A position's profit or loss (P/L) is equal to:&#x20;

$$
P/L= Size * \ Price\ Move\ (\%) \pm\ Funding
$$

For example, a 10,000 USDC long position entered at a market price of $100 will have a profit of 2,000 USDC at $120 (corresponding to a 20% favorable price move), not including [funding](#funding).

A 20 ETH short position entered at $1,000 will have a loss of 1 ETH at $1,050 (corresponding to a 5% unfavorable price move), not including funding.

Profits or losses are always calculated and paid in the same collateral asset you used for your position, regardless of whether it's a long or a short.

P/L % (percent) is calculated relative to a position's margin. For example, a 10 ETH position at 10× leverage has a margin of 1 ETH. A P/L of 0.5 ETH would correspond to a P/L % of +50%.

{% hint style="info" %}
Profit is paid out from the [pool](../../pool). If an asset pool has insufficient funds to pay out your profit, you will need to wait until there are enough funds in the pool to take profit.
{% endhint %}

## Funding

Funding rates are calculated hourly for each market and collateral asset based on the real-time open interest imbalance.

For example, if there are more longs than shorts on the BTC-USD market in USDC collateral, USDC-margined long positions will pay USDC-margined shorts on that market, in USDC.

Funding is implicitly added or subtracted to a position's unrealized profit or loss.

Each market has a Funding Factor (FF), which is the yearly rate at which longs (or shorts) pay shorts (or longs) if open interest were completely skewed toward longs (or shorts).

The hourly funding rate for a given collateral asset on a given market is equal to:

$$
(FF * (OI(short)-OI(long)) / (OI(long)+OI(short))) / (365 * 24)
$$

A negative funding rate indicates that shorts pay longs, while a positive funding rate indicates that longs pay shorts.

## Liquidation

A position can be liquidated once its P/L drops below the market's liquidation threshold.&#x20;

For example, a user submits a 10 ETH position at 10×. The margin tied to the position is 1 ETH.  Assuming the liquidation threshold for the market is -96%, if the position's P/L reaches -0.96 ETH, the position can be liquidated.

When a position is liquidated, its margin is transferred to the liquidity pool and the position is closed. There are no liquidation fees and no other positions in your account are affected.

## Auto-Deleveraging (ADL)

When unrealized profits (UPL) exceed a defined threshold,  ADL is triggered. Each asset has its own ADL threshold.&#x20;

$$
UPL > ADLthr * (Pool Balance + Buffer Balance)
$$

A Keeper ranks all positions by UPL and starts closing the most profitable ones on the dominant side (long or short) until the threshold is no longer breached. This ensures solvency and prevents excessive imbalance in the pool.



