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

# Mark Price

The Mark Price is used to calculate unrealized PNL, margin requirements, liquidation triggers, and conditional order activations. It is designed to be resistant to price manipulation by incorporating multiple data sources.

## Calculation

The Mark Price is updated approximately every 3 seconds, in sync with the oracle price feed. It is determined as the **median** of three price components:

1. **Price 1** = Oracle Price + 2.5-minute Moving Average of (Mid Price - Oracle Price)
2. **Price 2** = Mid(Ask1, Bid1, Last Price)
3. **Price 3** = Weighted median of perpetual contract mid-prices from five major exchanges (Binance, OKX, Bybit, Gate, MEXC) with weights 3:2:2:1:1

If only two of the three components are available, a fourth input is added: the 30-second moving average of Mid(Ask1, Bid1, Last Price).

```
Mark Price = Median(Price 1, Price 2, Price 3)
```

Where:

* **Oracle Price** is the weighted-average spot price from external exchanges (see [Oracle Price](/trading-rules/oracle-price.md)).
* **Mid Price** = (Ask1 + Bid1) / 2 on AFX's own order book.
* **Last Price** = Most recent trade price on AFX.

## Why Mark Price Matters

The Mark Price is distinct from the Last Price. While the Last Price reflects the most recent trade, the Mark Price provides a more stable and manipulation-resistant reference. It is used for:

* Calculating unrealized PNL and margin ratios.
* Determining liquidation triggers.
* Computing estimated liquidation prices shown in the UI.
* Triggering conditional orders (when set to Mark Price trigger type).

## During Listing

For newly listed contracts, during the initial risk-control period (first 15 minutes after trading begins), the Mark Price equals the Oracle Price. After this period, the Mark Price switches to the standard calculation described above.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.afx.xyz/trading-rules/mark-price.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
