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

# Prices & oracles

> The price types Tplus tracks, oracle sourcing, mark and impact prices, staleness, and dual-price checks.

Tplus tracks several price values per asset, each with a distinct role in margin, liquidation, and pricing.

| Price      | Source                                     | Used for                                      |
| ---------- | ------------------------------------------ | --------------------------------------------- |
| Oracle     | Chainlink, Pyth, and CEX feeds, aggregated | IM checks, MM checks, OI caps                 |
| Mark       | EMA of recent trade prices                 | IM checks, MM checks, mark-to-market          |
| Last trade | Worst fill price of the most recent trade  | Raw trade input; feeds the mark EMA           |
| Impact     | Order-book VWAP to a reference size        | Funding premium component; depth/stress input |
| USD        | Fixed at 1                                 | The quote unit; never stale                   |

Every price carries its own decimal precision.

## Oracle prices

An oracle service polls Chainlink, Pyth, and centralized-exchange (CEX) feeds, averages them, and publishes it to the clearing engine. Outliers are rejected, and an update whose source timestamp is more than 5 seconds from local time is rejected (a clock-skew guard).

Prices are read through threshold RPC consensus — multiple independent endpoints must agree before a value is accepted. The feed-to-asset mapping is onchain and can only be rotated by a council-signed operation. See [trust model](/security/trust-model#price-integrity).

## Mark price

The mark price is an exponential moving average of last-trade prices, with a 45-second half-life. The last-trade price of a fill is the **worst** price across the matched makers — the highest for a buy taker, the lowest for a sell taker — so a single favorable print cannot drag the mark. It is not a TWAP.

```text theme={null}
alpha = 1 - 2^(-elapsed_seconds / 45)
new_mark = old_mark + alpha * (last_trade_price - old_mark)
```

Example: if the old mark is `100`, the newest last-trade price is `110`, and 45 seconds have elapsed, `alpha = 0.5` and the new mark is `100 + 0.5 * (110 - 100) = 105`. If a buy taker fills against makers at `100` and `102`, the last-trade input is the worst fill for the taker: `102`.

## Impact price

The impact price is the volume-weighted price (VWAP) to execute a reference notional — 0.25% of the asset's open-interest cap — against the book, computed separately for the buy and sell sides. Impact prices feed the premium component of [funding rates](/trading/fees-and-rates#funding-rates) by measuring how far executable book depth is from the oracle. They are not part of the normal IM/MM dual-price checks, which use oracle and mark.

```text theme={null}
reference_notional = 0.0025 * open_interest_cap
impact_price = sum(price_i * quantity_i) / sum(quantity_i)
```

Example: if the open-interest cap is `200,000,000 USD`, the reference notional is `500,000 USD`. If the ask side fills `100,000 USD` at `100` and the remaining `400,000 USD` at `101`, the base filled is `100,000 USD / 100 + 400,000 USD / 101 = 4,960.396`. The buy impact price is `500,000 USD / 4,960.396 = 100.80`.

## Dual-price checks

Margin and liquidation never rely on a single price:

* **Initial margin** is the requirement to open or increase positions. Trade admission is checked at the oracle price and the mark price independently; IM surplus must be at or above zero for both.
* **Maintenance margin** is the requirement to not be liquidated. Liquidation checks MM surplus under the dual-price rule and begins only when MM surplus is below zero.

If only one source is available it is used for both sides; if neither is available the check fails. See [Margin](/trading/margin#margin-checks).

## Staleness and circuit breakers

Each source is tracked for freshness. Oracle prices go stale after 1 hour (sized to Chainlink heartbeats); mark and last-trade prices after 60 seconds. A stale source must deliver consecutive fresh updates before it counts as recovered, which prevents flapping. Prices past a 2-hour hard limit are never used. A newly listed asset, or one recovering after a restart, starts in a warming-up state that blocks risk-increasing trades until the oracle has delivered several consecutive fresh updates.

When prices stop arriving, the asset's price-state machine degrades: risk-increasing trades are blocked first, and if no usable price remains, the asset's collateral is valued at zero and trading and liquidation halt for it. Full state table: [Liquidations & circuit breakers](/trading/liquidations#circuit-breakers).
