Skip to Content
How Loaf worksOracles and price feeds

Oracles and price feeds

Oracles and price feeds set the oracle price each perpetual future tracks. An oracle is a service that brings prices from outside markets onto the exchange. A perpetual future (perp) is a contract on an asset’s price with no expiry, and its oracle price is the reference it tracks.

Oracle price

Loaf sets each perp’s oracle price in one of two ways, depending on what the perp is based on.

PerpsOracle price sourceSafeguards
Commodity and compute perps: gold, copper, lithium, uranium, iron ore, H100 GPU compute and electricityA price recipe for each market, read from outside venues and applied once two of the three signer hosts Loaf runs sign itSignatures, freshness and a move limit checked by the validity proofs; held prices and reduce-only periods
Perps on physical markets, and any asset whose main spot market is on LoafThe spot market’s own prices on Loaf, with no outside venues until enough liquidity trades thereSpot price bands and halts, and a mark price that one trade cannot set

Price recipes

Each perp-only market is bound to a numbered price recipe when it is listed, and a recipe never changes once it is published.

MarketRecipeHow often
GoldThe median of up to four prices: Binance’s, OKX’s and Bybit’s own gold indexes, each converted from USDT to USDC, and the oracle price of trade.xyz’s gold perp on Hyperliquid. A price that is missing, or more than 1% from the median of the prices received, is left out, and at least two must remain.Once a second
H100 GPU computeOKX’s own H100 index, converted from USDT to USDC. If OKX’s index jumps more than 5% from the last price used, the price stays at that last price. It moves again when OKX’s index comes back within 5% of it, or when two operators confirm the move. The market stays open meanwhile.Once a second
Copper, lithium, uranium, iron ore and electricityTBCTBC

Signed prices

A proposer computes each price from the market’s recipe and sends it, with the data behind it, to three signer hosts run by Loaf. Each host checks the price against its own reads and signs only if they match. A price applies once two of the three sign it, so one faulty or offline host cannot set it alone. The validity proofs check the signatures against the signer accounts set on the blockchain TBC.

Each price’s input data is kept in the signer hosts’ audit logs TBC.

Move limits and held prices

The validity proofs accept a new oracle price only if it is newer than the last one, fresh, and within the market’s move limit TBC. A price that would move faster than that is held: the signer hosts do not sign it until two operators release it, and then walk it in at the fastest pace the move limit allows. The market is reduce-only while the price is held.

Late and stale prices

  • Late. Once the oracle price is more than 5 seconds old, the market is reduce-only: it takes no order that adds exposure, and no collateral leaves a pool that holds it.
  • Stale. Once the oracle price is older than the market’s staleness window, nothing is liquidated in that market until a fresh price arrives. The window is set for each market: 180 seconds for gold and copper, and 10 seconds for H100 compute.
  • Halted. After 15 minutes without a price, the oracle halts that market’s price.

Perps on physical markets

Perps on physical markets take their oracle price from the spot market’s own prices on Loaf TBC. The spot market’s price bands limit how far its price can move at once (see Halts and price bands), and the perp’s mark price is a median of several estimates, kept within a band around the oracle price, so one push on a thin spot book cannot set it alone. The same applies to any asset whose main spot liquidity is on Loaf: its oracle price includes no outside venue until enough liquidity trades there TBC.

Mark price

The mark price is Loaf’s estimate of a perp’s fair price: the median of the oracle price plus a capped average premium, the midpoint of the perp’s impact bid and ask, and outside venues’ perp prices, kept within a band around the oracle price that is set for each market by its maintenance rate. Oracle and mark prices explains each estimate. Loaf uses the two prices for different jobs.

PriceUsed for
Mark priceMargin, liquidations, auto-deleveraging ranking, stop and take-profit triggers, the order price band, and profit and loss
Oracle priceFunding, and the prices of exits, settlements and forced closes

Margining shows how the mark feeds into each position.

Warning. Validity proofs check each oracle price’s signatures, freshness and move limit, and that each mark sits within its market’s band around it. They do not check whether a price was right, the outside prices behind the mark, or the funding premium beyond its cap. A faulty price could still affect funding, margin and liquidations.

Last updated on