# Oracle Pricing (/docs/risex/trading/oracle-pricing)

RISEx works directly with [Stork](https://docs.stork.network/), an independent oracle provider, to pull in its index prices. The following external / calculated prices are used when keeping the exchange functional:

* **Index price:** The index price is used in the funding rate and mark price formulas. The index price is pulled directly from Stork and is the median of the spot price across multiple CEX providers
* **Mark price:** The mark price is the median of three price calculations *(see calcs below)*. The mark price is used to determine the users uPnL and is also the price used in determining whether a user should be liquidated.

***

## Mark Price Calculation Methodology

The mark price is determined by taking the median of three different prices:

**Mark = Median(P1, P2, P3)**

### P1 — Index-anchored premium

Look at the premium or discount our book is trading at against the index.

```
Impact Notional = 500 USDC / Initial Margin Fraction
Impact Bid      = avg fill price for market sell of Impact Notional
Impact Ask      = avg fill price for market buy of Impact Notional
Impact Price    = (Impact Bid + Impact Ask) / 2

P1 = Index + EMA_8min(clamp(ImpactPrice - Index, -Index/200, +Index/200))
where clamp(x, a, b) = max(a, min(b, x))
```

### P2 — Raw book signal

Average execution cost across both sides of the book.

```
Impact Notional Amount = 500 USDC / Initial Margin Fraction
Impact Bid Price       = avg execution price for market sell of impact notional
Impact Ask Price       = avg execution price for market buy of impact notional

P2 = (Impact Bid Price + Impact Ask Price) / 2
```

### P3 — External anchor

Mark price from an external provider (Stork).

```
P3 = Median(CEX mark prices)
```

All oracle prices are pushed directly and can be verified on RISE chain.
