Methodology
Every analytic on PythFeeds is computed from publicly auditable data. This page documents the exact formulas so you can reproduce or challenge any number you see.
1. Log returns
All return-based metrics use continuously-compounded log returns, not simple returns:
r_t = ln(P_t / P_(t-1))
Log returns are time-additive and approximately normally distributed for short horizons, which makes correlation, β and volatility math more stable.
2. Correlation (Pearson & Spearman)
Pearson measures linear co-movement of log returns:
ρ(x,y) = Σ((x_i − x̄)(y_i − ȳ)) / √(Σ(x_i − x̄)² · Σ(y_i − ȳ)²)
Spearman is Pearson computed on ranks — captures monotonic (not just linear) relationships and is robust to outliers.
3. Beta (β) vs BTC
β = Cov(r_asset, r_BTC) / Var(r_BTC)
β = 1 means the asset moves 1:1 with BTC. β > 1 amplifies BTC moves; β < 0 is negative correlation.
4. Annualized volatility
σ_annual = σ_daily · √365
Crypto uses 365 (not 252) because markets trade 24/7.
5. Sharpe ratio
Sharpe = (r̄ − r_f) / σ
Default risk-free rate r_f is 0% for crypto (adjustable in portfolio settings).
6. Maximum drawdown
MDD = max_t ( (peak_t − P_t) / peak_t )
The largest peak-to-trough decline in the period, as a percentage of the peak.
7. Pyth confidence interval
Every Pyth price ships with a conf value. The real price is bounded by price ± conf. For risk-sensitive use cases we apply:
- Lending collateral valuation: use
price − conf(conservative). - Debt valuation: use
price + conf(conservative). - Trading displays: show raw
pricewithconfas a secondary badge.
8. Staleness thresholds
- 🟢 Fresh: publishTime within last 2 seconds
- 🟡 Warm: 2–10 seconds old
- 🔴 Stale: older than 10 seconds — reject for trading
Equity feeds go stale outside US market hours by design.
9. Data sources
- Prices: Pyth Hermes API
- Historical OHLC: aggregated market-data API (cached)
- Solana quotes: Jupiter Aggregator
- Yields: DeFiLlama
Questions about a specific number? See the Glossary or open an issue on our community channels (see About).