Expand description
Hyperliquid-based Mark Price Oracle implementation.
This module provides a production-grade oracle that:
- Fetches oracle/index prices from Hyperliquid’s
metaAndAssetCtxsendpoint - Computes forward prices using
spot * e^(r * t) - Supports TWAP settlement with median-of-means and 5% trimming
- Persists samples to PostgreSQL for reproducibility
Structs§
- Hyperliquid
Mark Price Oracle - The main Hyperliquid Mark Price Oracle.
- Hyperliquid
Oracle Config - Configuration for the Hyperliquid Mark Price Oracle.
- Oracle
Fetch Result - Result of an oracle price fetch from Hyperliquid.
- Oracle
State 🔒 - Current state of the oracle.
- Price
Sample - A single price sample for TWAP computation.
- Settlement
Window - Settlement window tracking for TWAP computation.
Enums§
- Cached
Fallback 🔒Result - Cached result from a Hydromancer fallback attempt.
Constants§
- DEFAULT_
MAX_ MEMORY_ SAMPLES - Default maximum samples to keep in memory per settlement
- DEFAULT_
MIN_ SETTLEMENT_ SAMPLES - Default minimum samples required for settlement (local or Hydromancer)
- DEFAULT_
POLL_ INTERVAL_ MS - Default polling interval in milliseconds (2 seconds)
- DEFAULT_
RISK_ FREE_ RATE - Default risk-free rate (5%)
- DEFAULT_
TWAP_ WINDOW_ SECONDS - Default TWAP window in seconds (30 minutes)
- FALLBACK_
FAILURE_ 🔒TTL - TTL for cached Hydromancer failures before retry
- MIN_
SETTLEMENT_ 🔒SAMPLES_ FLOOR - Hard floor for MIN_SETTLEMENT_SAMPLES