Get Oracle Price Data
Retrieve oracle price data for a market:OraclePriceData Structure
TheOraclePriceData type contains price and confidence information from an oracle.
BN
required
Current oracle price in PRICE_PRECISION (1e6)
BN
required
Solana slot when the price was updated
BN
required
Price confidence interval in PRICE_PRECISION (1e6)
boolean
required
Whether the oracle has sufficient data points for reliability
BN
Time-weighted average price (if available)
BN
Confidence interval for TWAP (if available)
BN
Maximum price for pre-launch markets only
BN
Sequence identifier for the price update
Oracle Sources
Drift Protocol supports multiple oracle sources:OracleSource
Standard Pyth oracle with default price scaling
OracleSource
Pyth oracle with 1000x price scaling
OracleSource
Pyth oracle with 1,000,000x price scaling
OracleSource
Pyth pull-based oracle
OracleSource
Pyth pull oracle with 1000x scaling
OracleSource
Pyth pull oracle with 1,000,000x scaling
OracleSource
Switchboard v2 oracle
OracleSource
Switchboard on-demand oracle
OracleSource
Fixed price oracle for quote asset (USDC = $1)
OracleSource
Pyth stablecoin oracle
OracleSource
Pyth pull stablecoin oracle
OracleSource
Pre-launch market oracle
OracleSource
Pyth Lazer oracle (low-latency)
OracleSource
Pyth Lazer with 1000x scaling
OracleSource
Pyth Lazer with 1,000,000x scaling
OracleSource
Pyth Lazer stablecoin oracle
Validate Oracle
Check if oracle data is valid:Check Oracle Divergence
Check if oracle price diverges too much from mark price:OracleInfo Type
Oracle configuration for a market:Price Precision
All prices in Drift Protocol usePRICE_PRECISION (1e6):