ChainScore Labs
LABS
Guides

Understanding Mark Price vs Index Price in Perp Trading

Chainscore © 2025
core_concepts

Defining the Two Prices

Perpetual futures rely on two distinct price feeds to determine funding rates and liquidation levels. Understanding their separate roles and origins is critical for effective risk management.

01

Mark Price

The mark price is the real-time, on-chain price of the perpetual futures contract itself, derived from the contract's own order book. It reflects the current fair value based on market supply and demand.

  • Primary Use: Serves as the reference price for calculating unrealized PnL and triggering liquidations.
  • Calculation: Typically a time-weighted average of the mid-price or last traded price to prevent manipulation.
  • User Impact: Directly determines when a leveraged position becomes undercollateralized and is at risk of being force-closed by the protocol.
02

Index Price

The index price is the underlying spot price of the asset, aggregated from major centralized and decentralized spot exchanges. It represents the global consensus value of the asset outside the futures market.

  • Primary Use: Acts as the anchor or benchmark price for the perpetual contract, ensuring it does not deviate excessively from the real-world spot price.
  • Calculation: A robust, volume-weighted average from multiple trusted sources like Binance, Coinbase, and Uniswap.
  • User Impact: The index price is the target the mark price follows via the funding rate mechanism, preventing permanent price divergence.
03

Funding Rate Mechanism

The funding rate is a periodic payment between long and short traders, designed to tether the mark price to the index price. It is the core mechanism that defines perpetual contracts.

  • Trigger: Paid/received typically every 8 hours when the mark price deviates from the index price.
  • Direction: If mark > index, longs pay shorts to incentivize selling. If mark < index, shorts pay longs to incentivize buying.
  • User Impact: Traders must factor funding costs into their strategy, as they can significantly impact returns on held positions over time.
04

Price Oracle & Manipulation Resistance

Secure price oracles are essential for providing a reliable and manipulation-resistant index price. A compromised oracle can lead to incorrect liquidations and broken funding rates.

  • Oracle Design: Uses decentralized networks (e.g., Chainlink) or a proprietary set of exchanges with outlier filtering.
  • Attack Vectors: Includes flash loan attacks on a DEX to skew the spot price or wash trading on the futures market to manipulate the mark price.
  • User Impact: Robust oracles protect users from unfair liquidations and ensure the system's economic incentives function correctly.
05

Liquidation Engine

Liquidations occur when a position's margin balance falls below the maintenance margin requirement, calculated using the mark price. This process protects the protocol's solvency.

  • Reference Price: The mark price is used, not the index price, as it reflects the immediate price at which the position could be closed.
  • Safety Buffer: The difference between mark and index creates a buffer; a sudden spot market crash (index) won't instantly liquidate positions if the futures market (mark) lags.
  • User Impact: Understanding which price triggers liquidation is crucial for setting appropriate stop-losses and managing leverage.
06

Arbitrage & Price Convergence

Arbitrageurs play a vital role in enforcing the relationship between mark and index prices. Their actions help maintain market efficiency and price stability.

  • Opportunity: When the mark price diverges significantly from the index, arbitrage becomes profitable.
  • Action: If mark > index, arbitrageurs short the perpetual and buy the spot asset, pushing prices back toward parity.
  • User Impact: This activity narrows the premium/discount, reduces funding rate volatility, and provides liquidity, creating a healthier trading environment for all participants.

Mark Price vs Index Price: Key Differences

Comparison of the primary price mechanisms used in perpetual futures contracts.

FeatureMark PriceIndex PriceImpact

Primary Function

Used for calculating unrealized PnL and triggering liquidations

Reference price aggregated from major spot exchanges

Determines account health and risk events

Calculation Method

Time-weighted average of the Index Price and Funding Rate Basis

Volume-weighted median price from exchanges like Binance, Coinbase, Kraken

Mark price smooths volatility; index reflects real-time spot

Update Frequency

Updated every few seconds (e.g., 5-15s)

Updated in real-time with each spot trade on constituent exchanges

Mark price lags, reducing liquidation sensitivity to spot manipulation

Volatility

Lower volatility, designed to be resistant to manipulation

High volatility, reflects immediate market supply and demand

Prevents unnecessary liquidations during high spot volatility

Key Dependency

Derived from the Index Price and the current funding rate

Independent, based solely on aggregated spot market data

Mark price cannot exist without a reliable index

Role in Funding

Directly influences the funding rate paid between longs and shorts

Serves as the baseline for calculating the funding rate basis

Funding payments aim to tether mark price to index price

Liquidation Trigger

Position is liquidated if mark price reaches liquidation price

Not directly used for liquidation, but sharp moves affect mark price

Creates a buffer against spot market wicks and flash crashes

How Prices Drive the Funding Rate

Process overview

1

Calculate the Price Difference (Premium)

Determine the divergence between the perpetual contract's mark price and the underlying index price.

Detailed Instructions

The funding rate mechanism is triggered by the price premium or discount. This is calculated as the percentage difference between the mark price (the current trading price of the perpetual contract) and the index price (the spot price of the underlying asset aggregated from major exchanges).

  • Sub-step 1: Fetch the current mark price from the perpetual contract's order book, typically the mid-price between the best bid and ask.
  • Sub-step 2: Query the oracle for the current index price. For example, an ETH/USD perp might use an index composed of Coinbase, Binance, and Kraken spot prices.
  • Sub-step 3: Apply the premium formula: Premium = ((Mark Price - Index Price) / Index Price) * 100%. A positive result indicates the perpetual is trading at a premium.
javascript
// Example premium calculation const markPrice = 3050.50; // ETH Perp price const indexPrice = 3000.00; // Spot index price const premium = ((markPrice - indexPrice) / indexPrice) * 100; console.log(`Premium: ${premium.toFixed(4)}%`); // Output: Premium: 1.6833%

Tip: The premium is a key signal. A sustained high premium suggests strong bullish sentiment in the derivatives market relative to spot, which will trigger payments from longs to shorts.

2

Apply the Funding Rate Formula

Convert the price premium into a periodic funding rate using the protocol's specific parameters.

Detailed Instructions

The raw premium is fed into the protocol's funding rate formula. This formula typically includes a clamping mechanism and a rate cap to prevent excessive payments. The most common form is: Funding Rate = Premium / Funding Interval + Interest Rate Differential.

  • Sub-step 1: Determine the funding interval. Most exchanges calculate and exchange funding every 8 hours, so the interval is 3 (times per day).
  • Sub-step 2: Apply the clamping factor. Protocols often use a clamp coefficient (e.g., 0.05% or 5 basis points) to smooth volatility. The effective premium is max(min(Premium, Clamp), -Clamp).
  • Sub-step 3: Add the interest rate component. This is a small fixed rate (often zero) representing the cost of capital difference between the two currencies.
python
# Example funding rate calculation premium = 0.016833 # 1.6833% from previous step clamp = 0.0005 # 0.05% clamp funding_interval = 3 # 8-hour intervals per day interest_rate = 0.0001 # 0.01% clamped_premium = max(min(premium, clamp), -clamp) funding_rate = (clamped_premium / funding_interval) + interest_rate print(f"Funding Rate: {funding_rate:.6f}") # Output: Funding Rate: 0.001767

Tip: The clamp is critical for system stability. It prevents funding rates from spiraling during extreme market volatility or oracle manipulation attempts.

3

Determine Payment Direction and Magnitude

Establish which side (longs or shorts) pays and receives based on the calculated rate's sign.

Detailed Instructions

The sign of the funding rate dictates the cash flow direction. A positive funding rate means long positions pay shorts. A negative rate means shorts pay longs. The payment magnitude is the rate multiplied by the position size.

  • Sub-step 1: Check the rate sign. Using the previous example, a rate of 0.001767 (0.1767%) is positive.
  • Sub-step 2: Calculate the payment per contract. For a trader with a 1 ETH long position, the payment is Position Size * Funding Rate. At a mark price of $3050.50, the notional is $3050.50.
  • Sub-step 3: Apply the payment. The long trader's account is debited 1 ETH * 0.001767 = 0.001767 ETH. This value is distributed proportionally to all short traders.
solidity
// Simplified Solidity logic for payment direction function getPaymentAmount(int256 fundingRate, uint256 positionSize) internal pure returns (int256 payment) { // fundingRate can be positive or negative payment = (fundingRate * int256(positionSize)) / 1e18; // Assuming 18 decimals for rate // If payment > 0, longs pay. If payment < 0, shorts pay. }

Tip: The payment is applied directly to the position's collateral balance. A long trader paying funding will see their USDC or quote currency balance decrease, effectively incrementally closing their position unless more collateral is added.

4

Execute the Funding Payment

The protocol's smart contract automatically settles the calculated payments between counterparties at the funding timestamp.

Detailed Instructions

At predetermined funding timestamps (e.g., 00:00, 08:00, 16:00 UTC), the protocol's smart contract executes a state update to transfer the funding payments. This is a net settlement across all open positions.

  • Sub-step 1: Snapshot open positions. The contract records all active long and short positions and their sizes at the funding time.
  • Sub-step 2: Aggregate payments. It calculates the total quote currency (e.g., USDC) to be transferred from longs to shorts (or vice-versa) based on the finalized rate.
  • Sub-step 3: Update account balances. The contract deducts payments from the margin balances of the paying side and credits the receiving side. No actual token transfer occurs; it's an internal ledger update.
javascript
// Pseudocode for funding settlement async function settleFunding(rate) { const allLongs = await getOpenLongPositions(); const allShorts = await getOpenShortPositions(); let totalPaymentFromLongs = 0; for (let position of allLongs) { let payment = position.size * rate; totalPaymentFromLongs += payment; position.collateralBalance -= payment; // Deduct from long } // Distribute totalPaymentFromLongs proportionally to shorts distributeToShorts(totalPaymentFromLongs, allShorts); }

Tip: This process is gas-efficient as it updates internal balances in a single transaction. Traders must maintain sufficient collateral to cover funding payments to avoid liquidation.

5

Analyze the Impact on Market Equilibrium

Understand how the funding payment creates economic pressure to realign the mark price with the index price.

Detailed Instructions

The funding payment is a mechanism for convergence. By financially incentivizing one side of the market, it encourages trading activity that pushes the perpetual's price toward the spot index.

  • Sub-step 1: Assess the incentive. A positive funding rate (longs pay) makes holding long positions more expensive. Rational traders may reduce long exposure or open shorts to collect payments.
  • Sub-step 2: Observe market reaction. Increased selling pressure from longs closing or new shorts opening should cause the mark price to decrease toward the index price.
  • Sub-step 3: Monitor the feedback loop. As the premium narrows, the next funding rate calculation will yield a smaller value, reducing the incentive. This creates a negative feedback loop that stabilizes the price peg.

Consider a scenario where ETH spot is $3000 but the perp trades at $3100. The 3.33% premium causes longs to pay ~1.11% every 8 hours. This cost may trigger:

  1. Longs taking profits by selling their contracts.
  2. Arbitrageurs selling the perp and buying spot ETH.
  3. New traders opening shorts to earn the funding fee. All three actions increase sell-side pressure on the perp, pushing its price down toward $3000.

Tip: The efficiency of this mechanism depends on liquid markets and rational actors. In illiquid conditions, premiums/discounts can persist despite high funding rates.

How Each Price is Calculated

The Real-Time Trading Price

The Mark Price is the real-time, on-chain price used to calculate a trader's unrealized profit and loss (PnL) and to trigger liquidations. It is designed to be manipulation-resistant and is typically derived from a time-weighted average price (TWAP) of the underlying spot market on a decentralized exchange like Uniswap v3 or an oracle feed. This averaging mechanism smooths out short-term price spikes and prevents 'wick' liquidations caused by momentary market volatility. For a perpetual contract on GMX or dYdX, the mark price is not the last traded price on the perp market itself. This separation is critical; it ensures that a large market order on the perp exchange cannot directly manipulate the liquidation price of other traders, protecting the system's solvency.

Key Components

  • Oracle Source: Often a decentralized oracle like Chainlink or a DEX TWAP provides the primary price feed.
  • Averaging Period: The mark price is usually a TWAP over a set period (e.g., 5-30 minutes) to filter noise.
  • Funding Rate Anchor: The divergence between the mark price and the perp's own index price influences the funding rate, which incentivizes arbitrage to keep prices aligned.
liquidation_impact

Role in Liquidation and Risk Management

The divergence between mark and index prices is a critical mechanism for managing counterparty risk and ensuring protocol solvency in perpetual futures markets.

01

Liquidation Trigger

Mark price is the primary metric for determining liquidation events to prevent market manipulation.

  • Liquidations are triggered when a user's margin, valued against the mark price, falls below the maintenance threshold.
  • Using the index price here would be vulnerable to manipulation via spot market spoofing on a single exchange.
  • This protects the protocol from insolvency due to artificially induced liquidations.
02

Funding Rate Calculation

The funding rate is calculated based on the perpetual contract's mark price deviation from the underlying index price.

  • A positive funding rate is paid by longs to shorts when the mark price is above the index.
  • This mechanism incentivizes arbitrage to keep the perpetual contract price anchored to the spot market.
  • It directly manages the risk of perpetuals trading at a persistent, unsustainable premium or discount.
03

Insurance Fund Protection

The insurance fund covers bad debt from undercollateralized positions that cannot be fully liquidated.

  • Losses occur if a position is liquidated at a worse price than the mark price used for the trigger.
  • The mark price provides a more stable and manipulation-resistant valuation for determining the deficit.
  • This ensures the fund is only used for genuine system shortfalls, not exploited price gaps.
04

Position Valuation & PnL

A trader's unrealized PnL is typically calculated using the mark price, not the index.

  • This gives a real-time view of a position's health relative to the liquidation engine's valuation.
  • It allows traders to manage risk proactively based on the same metric that will trigger a margin call.
  • Using the index price for PnL would create a misleading gap between perceived and actual liquidation risk.
05

Oracle Security

The index price oracle must be robust and manipulation-resistant as it underpins the mark price calculation.

  • Protocols use a time-weighted average price (TWAP) from multiple spot exchanges to derive the index.
  • A compromised or lagging oracle can cause the mark price to diverge incorrectly, triggering faulty liquidations.
  • This makes oracle selection and design a foundational risk management consideration for any perp DEX.
06

Risk Parameter Calibration

Protocols set maintenance margin ratios and liquidation penalties based on expected mark price volatility.

  • Higher volatility assets require higher margins to account for larger potential gaps between mark and index prices during liquidations.
  • The penalty fee must cover the expected slippage when closing a position near the mark price.
  • Mis-calibration can lead to excessive liquidations or insufficient penalties to cover bad debt.

Common Questions on Price Feeds

The index price is the underlying reference price, typically a volume-weighted average from multiple centralized exchange spot markets. The mark price is the price used for calculating unrealized PnL and triggering liquidations on a perpetual futures contract. It is derived from the index price but incorporates a funding rate premium to track the spot index over time. For example, if the BTC index is $60,000, the mark price might be $60,050, with the $50 difference reflecting the funding rate mechanism to balance long and short interest.