Mark Price and Oracle Price
To ensure market integrity and prevent manipulation, TxFlow uses a dual-pricing system:
Oracle Price — External reference price from major CEXs (used for funding rates and slippage protection)
Mark Price — Fair value estimate for TxFlow's perpetual contracts (used for liquidations, PnL, and TP/SL triggers)
This separation ensures that liquidations and margin calculations are based on reliable, manipulation-resistant prices.
Oracle Price
The Oracle Price is the reference price for funding rate calculations and slippage protection. It is independent of TxFlow's order book, making it highly resistant to manipulation.
Key Characteristics
Data Source: Weighted median of spot mid-prices from major, high-liquidity CEXs
Update Frequency: Published by validators every ~3 seconds
Use Cases:
Funding rate calculations
Slippage tolerance enforcement (market orders)
Base input for Mark Price
How It's Calculated
Oracle Price = Weighted Median(P1,P2,...,Pn)
Where:
P₁, P₂, ..., Pₙ = Spot mid-prices from each CEX (e.g., Binance, Coinbase, OKX, Kraken)
Weights = Based on each exchange's trading volume and data reliability
💡 Why Weighted Median? Unlike averages, medians are robust against outliers—even if one exchange reports an erroneous price, it won't skew the Oracle Price.
Mark Price
The Mark Price is an unbiased estimate of the fair perpetual contract price. It is used for:
Liquidations — Determines when positions are liquidated
Unrealized PnL — Calculates floating profit/loss
Margin Calculations — Determines available margin
TP/SL Triggers — Activates take-profit and stop-loss orders
Key Characteristics
Data Source: Oracle Price + 30-second moving average of TxFlow's market premium
Update Frequency: ~3 seconds (synced with Oracle Price updates)
Purpose: Smooths out short-term volatility and prevents flash-crash liquidations
How It's Calculated
Mark Price = Oracle Price + Average Premium
Where:
Average premium in the last 30 seconds is calculated by sampling every second over a 30-second interval:
Moving average = Average of ((bid 1 + ask 1) ÷ 2 − Oracle Price)
And:
TxFlow Mid Price = (Best Bid+Best Ask) ÷ 2
💡 Why Include Premium? The premium reflects TxFlow's market sentiment (bullish/bearish relative to spot). Smoothing it over 30 seconds prevents manipulation via short-term order book spoofing.
Price Comparison
Data Source
Spot mid-prices from major CEXs (Binance, Coinbase, OKX, etc.)
Oracle Price + TxFlow's market premium
Independence
Fully independent of TxFlow's order book
Incorporates TxFlow's market sentiment
Primary Use
Funding rate calculations, slippage protection
Liquidations, unrealized PnL, margin calculations, TP/SL triggers
Update Frequency
~3 seconds (validator-published)
~3 seconds (synced with Oracle updates)
Manipulation Resistance
High (external data, weighted median)
High (smoothed premium prevents outliers)
When Each Price is Used
Liquidations
Mark Price
Prevents manipulation; smooths volatility
Unrealized PnL
Mark Price
Fair valuation; matches liquidation price
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
Related Pages
Detailed liquidation mechanics
Funding fees
Last updated
