Skip to main content

Module hyperliquid_oracle

Module hyperliquid_oracle 

Source
Expand description

Hyperliquid-based Mark Price Oracle implementation.

This module provides a production-grade oracle that:

  • Fetches oracle/index prices from Hyperliquid’s metaAndAssetCtxs endpoint
  • 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§

HyperliquidMarkPriceOracle
The main Hyperliquid Mark Price Oracle.
HyperliquidOracleConfig
Configuration for the Hyperliquid Mark Price Oracle.
OracleFetchResult
Result of an oracle price fetch from Hyperliquid.
OracleState 🔒
Current state of the oracle.
PriceSample
A single price sample for TWAP computation.
SettlementWindow
Settlement window tracking for TWAP computation.

Enums§

CachedFallbackResult 🔒
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