Skip to content

Oracles and Mark Price

Oracle Implementation

Perpetuity utilizes a dedicated Atlas oracle program that aggregates price data from three trusted sources:

  • Switchboard
  • Chaos Labs
  • Pyth

The oracle program updates price feeds at the beginning of each new block to ensure fresh price data. To enhance security and reliability:

  • Each price feed includes confidence intervals to measure price uncertainty
  • Multiple oracle sources are used to prevent manipulation and ensure price accuracy
  • The system validates oracle accounts and their ownership before processing any transactions
  • Price feeds include both current and previous prices for enhanced stability

Mark Price Calculation

The mark price is a sophisticated weighted average that combines multiple price inputs to create a fair and manipulation-resistant reference price. It incorporates:

  1. Last traded price from the orderbook
  2. Mid price (average of best bid and ask)
  3. Index price from the oracle feed
  4. Confidence intervals from price feeds

This composite approach helps:

  • Prevent market manipulation
  • Reduce the impact of temporary price spikes
  • Provide a more stable reference for funding rates and liquidations
  • Better reflect true market conditions by considering both on-chain and off-chain price sources

Price Impact Protection

The system implements several protective measures:

  • Impact price calculations that simulate large orders to prevent manipulation
  • Price bias checks that compare orderbook prices against oracle prices
  • Confidence interval thresholds that must be met for price acceptance

The mark price serves as a key component in:

  • Determining liquidation thresholds
  • Setting fair prices for order execution
  • Computing position values for margin requirements