> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qfex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Definitions and Formulae

> Common Terms Used in the Rulebook

### Market Data Price

The price of the underlying asset, derived from the relevant external oracle source.\
Denoted as $P_t^{\text{market}}$.

### Index Price

When the current market price stays within the allowed band, the index price is:

$$
P_t^{\text{index}} = P_t^{\text{market}}
$$

when

$$
P_t^{\text{market}} \in [0.5 P_{t-1}^{\text{market}},\; 1.5 P_{t-1}^{\text{market}}]
$$

Otherwise, the index price is held at the prior market price:

$$
P_t^{\text{index}} = P_{t-1}^{\text{market}}
$$

That is, the Index Price equals the current Market Data Price if it lies within ±50% of the previous value, otherwise the prior price is used.

### Oracle Price

Defined in [Contract Specifications](https://docs.qfex.com/qfex/contract-specifications.md):

### Mark Price

The Mark Price $P_t^{\text{mark}}$ is computed as:

$$
P_t^{\text{mark}} = \text{Median} \Big(
P_t^{\text{oracle}},\;
P_t^{\text{oracle}} + \text{EMA}_{150s}(M_t - P_t^{\text{oracle}}),\;
\text{Median}(B_t,\; A_t,\; T_t)
\Big)
$$

where $M_t$ is the mid price, $B_t$ the best bid, $A_t$ the best ask, and $T_t$ the last traded price.

### Unrealized PnL

$$
PnL_{\text{unrealized}} = \sum_i q_i \cdot (P_t^{\text{mark}} - P_{i,\text{entry}})
$$

for all open positions $i$ with quantity $q_i$.

### Realized PnL

$$
PnL_{\text{realized}}= \sum_j (P_{j,\text{exit}} - P_{j,\text{entry}}) \cdot q_j
$$

for all closed positions $j$.

### Cash

$$
\text{Cash} = D - W + F_{\text{net}} + RR - \text{Fees}
$$

where $D$ = deposits, $W$ = withdrawals, $F_{\text{net}}$ = net funding, $RR$ = referral rewards.

### Margin

The total equity required to support open positions and reserve for open orders:

$$
\text{Margin} = \text{Position Margin} + \text{Order Margin}
$$

### Position Margin

The maintenance margin required to keep filled positions open, recalculated at the current Mark Price. Account Position Margin is the sum of the requirements for all open positions:

$$
\text{Position Margin} = \sum_i |q_i| \times P_{i,t}^{\text{mark}} \times \frac{2}{3L_i}
$$

where $q_i$ is the net position quantity and $L_i$ is the selected leverage for symbol $i$. The initial margin rate is $1/L_i$; the maintenance margin rate is two-thirds of that rate.

Position Margin changes as positions are filled, reduced, or closed, and as Mark Prices change. It is used to assess whether the account has sufficient equity to maintain its positions; see [Margin and Liquidations](https://docs.qfex.com/qfex/liquidation-margin-call.md).

### Order Margin

The equity reserved for the unfilled quantity of open orders, covering initial margin and a taker-fee reserve:

$$
\text{Order Margin} = \sum_j |q_j^{\text{remaining}} \times P_j^{\text{order}}| \times \left(\frac{1}{L_j} + f_j^{\text{taker}}\right)
$$

where $P_j^{\text{order}}$ is the order price, $L_j$ is the selected leverage for the order's symbol, and $f_j^{\text{taker}}$ is the applicable taker-fee rate. The sum includes only orders that require a margin reservation. Reduce-only orders reserve no Order Margin because they cannot increase exposure.

Order Margin reduces Available Balance while an order is open. As an order fills, its reservation is released for the filled quantity and Position Margin is recalculated for the resulting position. Canceling an order releases its remaining reservation. The fee reserve is part of Order Margin; actual trading fees are charged on execution.

For example, at 10× leverage, a filled position worth USD 1,500 at Mark Price requires USD 100 of Position Margin. An additional open order with USD 1,000 of unfilled notional and a 0.05% taker-fee rate reserves USD 100.50 of Order Margin. Total Margin is USD 200.50.

### Account Equity

$$
\text{Equity} = \text{Cash} + PnL_{\text{realized}} + PnL_{\text{unrealized}}
$$

### Available Balance

$$
\text{Available Balance} = \text{Account Equity} - \text{Margin}
$$

### Withdrawable Balance

$$
\text{Withdrawable Balance} = \text{Cash} + PnL_{\text{realized}} + \min(PnL_{\text{unrealized}}, 0) - 1.05 \times \text{Margin}
$$

### Position Value

$$
V = P_t^{\text{mark}} \times Q
$$

where $Q$ is the position quantity in the symbol.

### Funding Rate

The rate $r_t^{\text{funding}}$ paid between long and short positions when the futures price deviates from the underlying index.

### Funding Fee

$$
\text{Funding Fee} = P_t^{\text{mark}} \times Q \times r_t^{\text{funding}}
$$

### Liquidation Spread

The maximum spread $\Delta_{\text{liq}}$ from $P_t^{\text{mark}}$ at which an orderly **Immediate-or-Cancel (IOC)** liquidation order is executed.

### DLP Fee

A fee $f_{\text{DLP}}$ paid to **Designated Liquidity Providers (DLPs)** who absorb liquidated positions.

### Mark-to-Market (MTM)

All portfolios are re-evaluated every **200 ms** using the Mark Price $P_t^{\text{mark}}$ to:

* Recalculate Unrealized PnL,
* Detect margin requirement breaches,
* Trigger liquidation procedures.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.