Delta-neutral funding rate harvesting for Hyperliquid
Osprey scans every Hyperliquid perpetual every minute, scores funding rate opportunities, and executes delta-neutral positions via MetaMask — in demo or live mode.
Hyperliquid pays funding every hour (vs. every 8h on Binance/Bybit). When a pair's funding rate is elevated, shorting the perpetual and going long spot earns that rate every hour — with zero directional exposure. You don't care if the price goes up or down.
Osprey automates the entire intelligence workflow:
| Feature | What it does |
|---|---|
| Scanner | Live heatmap of all HL funding rates — crypto AND TradFi (NVDA, AAPL, GOOGL, GOLD, WTIOIL, SPACEX) |
| Regime Detection | HOT / NEUTRAL / COLD market signal based on top 20 pairs by OI |
| Entry Signals | ENTER / WAIT / EXIT / AVOID per pair, based on rate persistence |
| Position Sizing | 5–100% of balance slider with live fee and break-even preview |
| Backtester | Replay any strategy on 180 days of real historical HL data |
| Demo Mode | Paper trading with live rate data — no capital required |
| Live Mode | Real orders via MetaMask, signed locally, submitted to Hyperliquid |
No — and this is intentional.
Osprey identifies opportunities and sizes positions. You confirm every trade. The flow is:
- Scanner shows elevated rate + ENTER signal on a pair
- Click Enter → modal shows size, fees, break-even, hourly income estimate
- Confirm → Osprey submits the perp order to HL via MetaMask
- Manually execute the spot hedge on HL or another exchange
The Rotation Engine shows which pair to move capital to — it does not auto-execute. Fully automated execution is on the roadmap (v2: Telegram alerts, v3: semi-automated).
Fully working:
- MetaMask connect with real Hyperliquid address
- Real balance fetch from HL's
clearinghouseStateAPI after connect - Order submission to HL
/exchangewith correct EIP-712-variant signing - Correct asset index lookup from HL's universe (not hardcoded)
- Post-only (Alo) order type by default — maker fee (0.010%) instead of taker (0.035%)
- Automatic Alo → Ioc fallback if the post-only order would cross the book
Requires manual step:
- Spot hedge leg — HL's spot market doesn't cover all perp pairs. Execute on HL spot or a CEX.
Label:
- Live trading is marked Beta in the UI — test on HL testnet before using real capital.
Osprey now uses the minimum-fee order routing strategy on Hyperliquid:
| Leg | Order type | HL TIF | Fee rate | Per $5k notional |
|---|---|---|---|---|
| Entry | Post-only limit | Alo |
0.010% (maker) | $0.50 |
| Exit | Immediate-or-cancel | Ioc |
0.035% (taker) | $1.75 |
| Rebalance | Immediate-or-cancel | Ioc |
0.035% × drift notional | variable |
Round-trip saving vs. previous (both legs taker):
Before (v17): $1.75 + $1.75 = $3.50 per round-trip on $5k
After (v18): $0.50 + $1.75 = $2.25 per round-trip on $5k → −36%
If both legs can be maker (e.g. patient exit via GTC limit):
Best case: $0.50 + $0.50 = $1.00 per round-trip on $5k → −71%
placeMarketOrder() in src/api/hyperliquid.ts accepts an optional tif parameter:
// Default: post-only maker (0.010% fee)
await placeMarketOrder({ coin, isBuy, sz, px, address, provider });
// Explicit taker for urgent exits (0.035% fee)
await placeMarketOrder({ coin, isBuy, sz, px, address, provider, tif: 'Ioc' });The auto-trader automatically falls back from Alo to Ioc when the post-only order
would immediately cross (e.g. during a fast market move), so fills are never missed.
Higher volume reduces the taker leg further:
| 30d Volume | Maker | Taker |
|---|---|---|
| Default | 0.010% | 0.035% |
| ≥ $5M | 0.008% | 0.030% |
| ≥ $25M | 0.005% | 0.025% |
| ≥ $100M | 0.002% | 0.020% |
Update DEFAULT_STRATEGY.takerFee and DEFAULT_STRATEGY.makerFee in
src/utils/constants.ts when your account reaches a higher tier. The backtester
and all fee previews will update automatically.
The backtester (v18) correctly models:
- Entry fee =
capitalUSDC × makerFee(Alo post-only) - Exit fee =
capitalUSDC × takerFee(Ioc taker) - Rebalance fee =
driftNotional × takerFee(based on actual drift %, not a fixed heuristic)
Previously all legs used takerFee, making backtest P&L 36% more pessimistic than reality.
git clone https://github.com/Xtley001/osprey.git
cd osprey
npm install
cp .env.example .env.local
npm run devOpens at http://localhost:5173. Demo mode works immediately — no wallet or API key needed.
- Deposit USDC to your Hyperliquid account at app.hyperliquid.xyz
- Open Osprey → Settings → Connect MetaMask
- Osprey fetches your real HL balance and displays it
- Switch to Live mode in the sidebar
- Click Enter on any pair — modal shows your real balance and position summary
- MetaMask signs the order locally → submitted to HL
Your private key never leaves MetaMask. Osprey only receives the signed payload.
Osprey is fully responsive:
- Mobile (<768px): bottom navigation bar, positions in slide-over panel, tables scroll horizontally
- Tablet (768–1024px): icon-only sidebar, positions button in topbar
- Desktop (>1024px): full three-column layout
Install as a PWA from Chrome — click the install icon in the address bar. Runs as a standalone app, no tab required.
| Layer | Choice |
|---|---|
| Frontend | React 18 + Vite + TypeScript (strict) |
| State | Zustand with pre-computed derived state (no inline selectors) |
| Data | Hyperliquid REST API — live rates + historical + account state |
| Signing | MetaMask + ethers v6 — EIP-712-variant, correct asset index |
| Charts | Canvas API (custom, no external chart lib overhead) |
| Testing | Vitest — 37 unit tests, engine + utilities |
| PWA | Service Worker + Web App Manifest |
| Deployment | Vercel — zero config, instant deploys |
npm i -g vercel && vercel --prodvercel.json SPA rewrites are pre-configured.
npm run dev # dev server → localhost:5173
npm run build # production build
npm run typecheck # tsc --noEmit (0 errors enforced)
npm test # vitest run — 71 tests
npm run test:watch # watch mode
npm run test:coverage # coverage reportSee SETUP.md and TESTING.md for full details.
npm i -g vercel
vercel --prodvercel.json SPA rewrites are pre-configured. No extra setup needed.
| Limitation | Status |
|---|---|
| Spot hedge auto-execution | Manual — HL spot market limited. Use HL spot or a CEX for the long leg. |
| Position persistence | Browser memory only — closing the tab clears open positions. Backend persistence is v2. |
| Rotation auto-execution | Recommendations only — does not auto-trade. |
| Testnet mode | Not yet available in UI — test on mainnet with minimum size first. |
| Mobile optimised trading | Functional but optimised for desktop workflows. |
- Backend service (Node.js + PostgreSQL) for persistent positions across sessions
- Telegram / email alerts when ENTER signals fire on watchlisted pairs
- Testnet mode in UI
- Spot hedge instructions per pair (which exchange, which instrument)
- Semi-automated rotation (Telegram approval flow)
- Mobile-optimised entry flow
- GTC limit exit orders for full maker round-trips (−71% fee vs v17 baseline)
- Per-account fee tier config (auto-detect from HL user state API)
Osprey dives when the rate is right.