Cross-Exchange Funding Rate Analysis
We built an open-source Jupyter notebook that compares BTC funding rates across Hyperliquid and Lighter using historical data from 0xArchive.
The notebook draws on the Hyperliquid data and Lighter data APIs.
Compare the rate definitions in Hyperliquid funding history and Lighter funding history when normalizing funding across venues.
What It Does
- Fetches funding rate snapshots from both exchanges via a single
oxarchivePython 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
Use a free API key from 0xarchive.io/dashboard to run the notebook against historical market data.
