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

What Is Oracle Price in Crypto? Definition & How It Works

Oracle price is the external reference price fed into a perpetual DEX to anchor contracts to real-world asset values. Learn how it works on AFX for BTC, gold, oil, and SpaceX.

Oracle price is an externally sourced reference price fed into a smart contract or on-chain trading system to represent the fair value of an asset. On AFX, the oracle price anchors each perpetual contract to its real-world underlying — whether that is Bitcoin, gold, crude oil, or SpaceX's private market valuation — and is used to calculate mark price, which drives PnL and liquidation thresholds.

Why Perpetual DEXes Need Oracles

A perpetual contract on a DEX only sees prices from its own order book. If a trader places a large order that moves the SPCX-PERP last traded price by 5%, the contract has no way to know whether that move reflects a real change in SpaceX's valuation or a thin-book manipulation.

The oracle solves this by bringing an external price reference on-chain. Instead of using the last traded price in the AFX book, the protocol derives mark price from the oracle — which aggregates data from multiple external sources and is far harder to manipulate with a single order.

This is especially critical for assets like XAU-PERP, CL-PERP, and SPCX-PERP, where the underlying asset trades in a completely separate market (commodity exchanges, private equity platforms) that has no direct connection to the AFX order book.

How Oracle Price Works on AFX

On AFX, each perpetual pair displays both a last traded price (the most recent fill in the AFX order book) and an oracle price (the external reference). You can see both in the trading interface.

The oracle price feeds into the mark price formula:

Mark Price ≈ Oracle Price × (1 + Funding Basis)

The funding basis is a short-window moving average of the premium or discount between the last traded price and the oracle price. This means:

  • If SPCX-PERP is trading at a premium to oracle (buyers pushing the price up), the funding basis is positive, longs pay shorts, and the price is pushed back toward oracle

  • If it is trading at a discount, shorts pay longs, and the price is pulled back up

This mechanism keeps each AFX perpetual anchored to its real-world reference without requiring an expiry date.

Oracle Sources by Asset Type

Different AFX pairs use different types of oracle data, depending on where the underlying asset trades:

Pair
Underlying
Oracle Data Source

Bitcoin

Aggregated spot prices across major crypto venues

Ethereum

Aggregated spot prices across major crypto venues

Gold (XAU/USD)

Commodity market reference data

WTI Crude Oil

Commodity market reference data

SpaceX private valuation

Private market reference data

For crypto pairs (BTC, ETH), the oracle aggregates prices across multiple liquid spot exchanges — making it resistant to manipulation on any single venue. For commodity and private asset pairs, the oracle draws from specialist data sources covering those markets.

Oracle Price vs Last Traded Price vs Mark Price

These three prices are visible in the AFX interface and each serves a different purpose:

Price
What It Is
Used For

Last Traded Price

The price of the most recent fill in the AFX order book

Displayed on charts; used for order execution

Oracle Price

External reference aggregated from real-world sources

Anchor for mark price calculation

Mark Price

Oracle price + funding basis adjustment

Unrealized PnL display; liquidation threshold

Your position is never liquidated based on last traded price. A temporary wick — a large order that briefly moves the last traded price far from oracle — does not trigger liquidation because mark price stays anchored to oracle.

The gap between last traded price and oracle price tells you the current market sentiment: a positive gap (last > oracle) means buyers are paying a premium and funding will flow from longs to shorts at the next settlement.

What Happens When Oracle and Market Price Diverge

Persistent divergence between oracle price and last traded price triggers the funding rate mechanism to close the gap over time. If the AFX SPCX-PERP price climbs significantly above the oracle reference — because traders are bullish on SpaceX — longs pay shorts every 4 hours until the price converges back toward oracle.

For large, sudden divergences caused by breaking news (a Starship launch result, a Fed decision affecting gold prices), the oracle update and last traded price may temporarily diverge sharply before converging as market participants absorb the new information.

Traders should monitor the oracle price alongside the last traded price, particularly on non-crypto pairs where the underlying market may be closed (e.g., gold on weekends), causing the oracle to update less frequently while AFX continues trading.

FAQ

Can the oracle price be manipulated?

Oracles aggregate data from multiple external sources, making manipulation significantly harder than manipulating a single order book. Moving the oracle price for a liquid asset like gold or Bitcoin would require moving prices across multiple large external markets simultaneously — an extremely high bar. For private assets like SpaceX, the oracle draws from available private market reference data, which updates less frequently but is not directly controllable by any single AFX participant.

Why does my unrealized PnL sometimes differ from what I calculate using the last traded price?

Because unrealized PnL on AFX is calculated using mark price, not last traded price. If the last traded price is temporarily above or below the oracle reference — due to a large order, thin liquidity, or market sentiment — mark price will differ from last traded price. As the two converge (driven by the funding rate mechanism), your displayed unrealized PnL adjusts accordingly.

Is the oracle price the same as the index price I see on other platforms?

They serve the same function but may differ in implementation. "Index price" and "oracle price" are often used interchangeably — both refer to an external reference price anchoring the perpetual contract. On AFX, the term "oracle price" is used in the interface. The calculation methodology may vary by platform.


Keep Learning


This article is for informational and educational purposes only. It does not constitute financial or investment advice. Not Financial Advice (NFA).

Last updated