> For the complete documentation index, see [llms.txt](https://sodex.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sodex.com/documentation/trading-mechanics/index-price-and-mark-price.md).

# Index Price & Mark Price

To ensure market integrity and protect against manipulation, SoDEX utilizes a robust, multi-faceted pricing system. This system is built on two core concepts: the Index Price and the Mark Price. Each serves a distinct purpose and is calculated using different data sources to provide a reliable and fair valuation for perpetual contracts.<br>

## Index Price

The **Index Price** represents the fair market value of the underlying spot asset, aggregated from multiple high-liquidity exchanges. To ensure robustness and prevent stale or manipulated inputs:

* Any exchange price is excluded if no trade occurred in the past 60 seconds
* The Index Price is computed as a median-based aggregation across all valid spot exchanges

**Calculation Method**

The Index Price is calculated as a weighted median of the mid-prices of the corresponding spot asset, from a basket of major, high-liquidity exchanges. The weights are assigned based on the relative trading volume and reliability of each exchange.

Let $$P\_i$$ be the latest valid spot price from exchange $$i$$

$$
\text{Index Price} = \text{Weighted Median}(P\_1, P\_2, ..., P\_n)
$$

$$
\text{Valid}(P\_i) =
\begin{cases}
\text{true}, & \text{if last trade } \le 60s \\
\text{false}, & \text{otherwise}
\end{cases}
$$

## Mark Price

The **Mark Price** is a manipulation-resistant reference price used for all core risk-management functions, including margin evaluation, liquidation triggers, unrealized PnL calculation, and fair account health assessment across the perpetual trading system.

It combines the global fair value of the underlying asset with SoDEX local liquidity signals through a multi-source median mechanism, ensuring stable and fair valuation throughout different market conditions.

**Calculation Method**

To ensure a fair and stable valuation, the Mark Price is determined by combining multiple independent price signals:

$$
\text{Mark Price} = \text{Median}(\text{Index Price}, \text{Smoothed Index Price}, \text{Local Price}, \text{External Perp Mid Price})
$$

1. **Index Price**
2. **Smoothed Index Price**\
   A stability-enhanced version of the Index Price, adjusted by a short-term EMA to avoid sudden deviations.

$$
\text{Smoothed Index Price} = \text{Index Price} + EMA\_{150s}(\text{Index Price} - \text{Mid Price})
$$

3. **SoDEX Local Price**\
   Represents real trading conditions on SoDEX, based on the median of best bid, best ask, and mid price.

$$
\text{Local Price} = \text{Median}(\text{Best Bid}, \text{Best Ask}, \text{Last Trade Price})
$$

4. **External Perp Mid Price**\
   Provides additional reference from leading derivatives exchanges to maintain alignment with broader perp markets.

$$
\text{External Perp Mid Price} = \frac{\text{Ext Best Bid} + \text{Ext Best Ask}}{2}
$$

5. **smoothed local pricing.**\
   If only two price sources are valid, **smoothed local pricing** is added to maintain stability and manipulation-resistance.

$$
\text{Smoothed Local Price} = EMA\_{30s}(\text{Local Price})
$$
