> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/trading/fair-price-marking.md).

# Fair Price Marking

***Mark price*** is the fair price of a perpetual contract. Mark price is calculated using the liquidity in the perpetual market order book and the ***index price*** (spot price of the underlying market). At any point in time, mark price is defined as follows:

$$
\small
\text{Impact Notional Amount} = 500 \text{ USDC} / \text{Initial Margin Fraction} \\
\text{Impact Bid Price}\_t = \text{Avg execution price for a market sell of the impact notional value} \\
\text{Impact Ask Price}\_t = \text{Avg execution price for a market buy of the impact notional value} \\
\text{Impact Price}\_t = (\text{Impact Bid Price}\_t + \text{Impact Ask Price}\_t) / 2 \\
\\~~\\
\text{price1}*t = index\_t + \operatorname{EMA}*{8\ \mathrm{min}}(
\text{clamp}(
\text{Impact Price}*t - index\_t, -index\_t/200,+index\_t/200
))
\\
\text{where} \operatorname{clamp}(x,a,b) = \max\bigl(a,;\min(b,x)\bigr) \\
\text{and} \operatorname{EMA}*{8\ \mathrm{min}} \text{refers to the Exponential Moving Average of the value over 8 minutes}
\\~~\\
\text{price2}\_t = median(\text{cexPrices}\_t)
\\
\text{where cexPrices}\_t \text{ are mark prices from different centralized exchanges}
\\\~\\
\text{Mark Price} = Median(\text{Impact Price}\_t, price1\_t, price2\_t)
$$

Lighter uses a combination of oracles (Chainlink, Stork, Pyth) to determine the index price.

**Note**: because the mark price is used when deciding if liquidations should be happening, the mark price should reflect as much as possible the impact price, so that the execution of liquidations should happen close to mark price. Because of this, we chose to incorporate the impact price directly in the mark price formula. Price 1 can be summarised as Index Price + Lighter Perpetual Premium, where the premium is capped at 0.5% of the Index Price. The usage of the EMA makes it so if someone tries to manipulate the order book, they'd need to do so for a prolonged period of time. The ±0.5% cap applies to the premium component (`price1`) relative to the index price. In summary, the EMA component should yield better results than just using the funding rate due to the shorter time span, while also being resilient to manipulation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/trading/fair-price-marking.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
