For the complete documentation index, see llms.txt. This page is also available as Markdown.

Mark Price and Oracle Price

TxFlow uses two reference prices to ensure market integrity and prevent manipulation.

Price
Source
Used for

Oracle Price

Weighted median of spot prices from major CEXs

Funding rate calculation, slippage protection

Mark Price

Oracle Price + 30-second smoothed premium

Liquidations, unrealized PnL, margin, TP/SL triggers

Oracle Price

The Oracle Price is the external spot reference for a market. It is fully independent of TxFlow's order book, making it highly resistant to manipulation.

Calculation:

Oracle Price = Weighted Median(P₁, P₂, ..., Pₙ)

Where P₁...Pₙ are spot mid-prices from major CEXs (e.g., Binance, Coinbase, OKX, Kraken), weighted by each exchange's trading volume and reliability.

  • Update frequency: ~every 3 seconds, published by validators

  • Why weighted median? Unlike a simple average, the median is robust against outliers — a single exchange reporting an erroneous price cannot skew the result.

Mark Price

The Mark Price is TxFlow's fair-value estimate of the perpetual contract. It is derived from the Oracle Price plus a smoothed market premium that filters out short-term noise.

Calculation:

Mark Price = Oracle Price + Average Premium

Where Average Premium is the moving average of:

Average Premium = Average of ((bid 1 + ask 1) ÷ 2 − Oracle Price)

Sampled every second over a 30-second window (= 30 samples).

  • Update frequency: ~every 3 seconds, synced with Oracle updates

  • Why include premium? It reflects TxFlow's market sentiment relative to spot. Smoothing over 30 seconds prevents manipulation via short-term order book spoofing.

When each price is used

Use Case
Price Used
Reason

Liquidations

Mark Price

Prevents manipulation; smooths volatility

Unrealized PnL

Mark Price

Fair valuation consistent with liquidation logic

Margin requirements

Mark Price

Consistent with liquidation logic

Funding rate calculation

Oracle Price

Independent reference; prevents funding manipulation

Slippage protection (market orders)

Oracle Price

Detects extreme execution prices vs. external reference

TP/SL triggers

Mark Price

Consistent with PnL calculations

Pages
Description

Detailed liquidation mechanics

Funding fees

Last updated

Was this helpful?