Back to Blog

Examples

Funding Rate Arbitrage: Hyperliquid x Lighter

Funding Rate Arbitrage: Hyperliquid x Lighter

Cross-Exchange Funding Rate Analysis

We built an open-source Jupyter notebook that compares BTC funding rates across Hyperliquid and Lighter.xyz using historical data from 0xArchive.

What It Does

  • Fetches funding rate snapshots from both exchanges via a single oxarchive Python SDK client
  • Auto-detects rate conventions (HL hourly vs Lighter 8h) and normalizes to comparable 8-hour rates
  • Generates 6 visualizations:

Side-by-side funding rate comparison - see how rates move across venues

Spread analysis with +/-2 sigma statistical threshold bands

Annualized carry (APR) with filled spread area

Arbitrage opportunity window detection with shaded regions

Cumulative hypothetical P&L from spread-harvesting

Distribution analysis with skew/kurtosis stats

Example Output (7-day window)

9,925 HL + 38,040 Lighter snapshots, 110 aligned hours, 2 arb windows detected, 25 bps hypothetical P&L (13% annualized).

Get Started

pip install -r requirements.txt
cp .env.example .env
jupyter notebook funding_rate_scanner.ipynb

Works with a free API key from 0xarchive.io/dashboard (BTC, 30-day lookback).

Links

This is our second example - showcasing the SDK's multi-exchange capability. More examples coming (OI divergence, market microstructure).