Autonomous Trading Terminal for Hyperliquid (testnet)
HyperAgent is an interactive terminal-based trading agent that watches the market in real-time, detects trading opportunities using multiple strategies, executes trades autonomously, manages risk with trailing stop-losses, and explains every decision with AI — all from a single terminal interface.
You pick a strategy. You hit Start. It trades by itself.
pipx install hyperliquidagent
hyperagentFirst run launches a short setup wizard (asks for your main wallet address and an agent-wallet private key — see Safety below), then drops you into the TUI.
Upgrade any time:
pipx upgrade hyperliquidagentNever used Python before? Jump to Beginner Setup — it walks you through everything from scratch.
HyperAgent is experimental software provided "as-is" with no warranty of any kind.
- Not financial advice. Nothing in this project, its code, its output, or its AI-generated explanations constitutes financial, investment, or trading advice. Signals and reasoning produced by the agent can be wrong.
- Testnet only — for now. This release signs exclusively on Hyperliquid testnet. Testnet USDC has no monetary value. Do not modify the code to point at mainnet unless you fully understand the risks and accept full responsibility for any losses.
- Trading is risky. Automated trading strategies can and do lose money. Past performance of any strategy — backtested or live — is not indicative of future results. Liquidation cascades, funding flips, and breakout plays can move against you faster than stop-losses can react.
- Bugs happen. This is experimental code. Expect edge cases, race conditions, and unhandled API errors. Review the source before running it, and never run it unattended with funds you cannot afford to lose.
- You are responsible. By installing or running HyperAgent you acknowledge that all trades, gains, and losses executed through it are solely your responsibility. The authors and contributors accept no liability for any outcome.
- Compliance is on you. Automated perpetual-futures trading may be restricted or regulated in your jurisdiction. Check your local laws before using this tool.
If you've never run a Python script, installed a CLI tool, or used a terminal before, follow this section from top to bottom. It takes ~10 minutes.
You need three things on your computer:
- Python 3.9 or newer — the language HyperAgent is written in
- pipx — a tool that installs Python CLI apps cleanly (so they don't clash with anything else)
- A terminal — Command Prompt / PowerShell on Windows, Terminal on macOS, any shell on Linux
You also need:
- A crypto wallet (MetaMask, Rabby, etc.) with a testnet-capable address
- ~10 minutes and an internet connection
- Go to python.org/downloads and download the latest Python 3.12+ installer.
- Run the installer. Check the box that says "Add python.exe to PATH" at the bottom of the first screen before clicking Install. This is the single most common thing beginners miss.
- Open PowerShell (press
Winkey, typepowershell, hit Enter) and verify:You should seepython --versionPython 3.12.xor similar. If you see "command not found", close PowerShell, reopen it, and try again. If still broken, reinstall Python and double-check the PATH box.
Easiest path is Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python
python3 --versionMost distros ship Python 3. Verify with python3 --version. If missing:
# Debian/Ubuntu
sudo apt update && sudo apt install python3 python3-pip python3-venv
# Fedora
sudo dnf install python3 python3-pippipx installs command-line Python tools into their own sandbox so they don't break each other.
python -m pip install --user pipx
python -m pipx ensurepathClose and reopen PowerShell after this. ensurepath adds pipx to your PATH, but existing shells won't see the change.
brew install pipx
pipx ensurepathpython3 -m pip install --user pipx
python3 -m pipx ensurepathVerify pipx works by running pipx --version in a fresh terminal window.
Now the actual app. In your terminal:
pipx install hyperliquidagentYou should see pipx download the package and print something like installed package hyperliquidagent 0.1.x. If you ever need to update:
pipx upgrade hyperliquidagentHyperAgent only trades Hyperliquid testnet, which uses play-money USDC. To fund your testnet wallet:
- Visit app.hyperliquid-testnet.xyz.
- Connect your wallet (MetaMask, Rabby, etc.).
- Click the faucet / "Claim testnet USDC" option. You'll get free testnet funds — no real money moves.
HyperAgent never asks for your main wallet's private key. Instead, you create a disposable "agent key" that can only place/cancel trades — Hyperliquid's exchange itself blocks it from withdrawing funds.
- Go to app.hyperliquid-testnet.xyz/API.
- Click Generate.
- A
approveAgenttransaction pops up in your wallet. Sign it with your main wallet — this tells Hyperliquid "this agent key is allowed to trade on my behalf." - Copy the agent private key shown on screen (long hex string starting with
0x…). Save it somewhere safe for now; you'll paste it into the wizard in step 8. - Also copy your main wallet address (the public
0x…address you signed with).
You can revoke the agent key any time from the same page — one click, no email, no support ticket.
Only needed if you want to use the Liquidation Cascade v2 strategy. Skip this section otherwise — every other strategy works without it.
- Go to app.hypedexer.com/dashboard/keys.
- Sign in / create an account.
- Click Create API Key (or similar — the button on the Keys dashboard).
- Give it a name like
hyperagentand create it. - Copy the generated key. You'll paste it into the wizard when it asks for
HYPEDEXER_API_KEY.
Keep this key private — treat it like a password. If it leaks, revoke it from the same dashboard.
Only needed if you want Claude Haiku to explain trades in plain English. Skip if you don't care.
You need an AWS account with Bedrock access to Claude Haiku enabled. You'll be prompted for:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGION(defaultus-east-1)
In your terminal:
hyperagentThe wizard will prompt you, one at a time, for:
| Prompt | Paste here |
|---|---|
| Main wallet address | The 0x… public address from step 6 |
| Agent private key (hidden) | The agent key from step 6 |
| Enable AI? | y if you did step 8, else n |
| Enable HypeDexer? | y if you did step 7, else n |
Input is hidden for sensitive fields (you won't see the key as you type/paste — that's normal).
When done, HyperAgent saves config to:
- Windows:
C:\Users\<you>\.config\hyperagent\.env - macOS/Linux:
~/.config/hyperagent/.env
…with restrictive file permissions (chmod 600 on Unix).
You'll land in the TUI. Pick a strategy from the dropdown, hit Start, and watch it go. Use the keybindings below to navigate.
To reconfigure later (rotate keys, add AWS creds, etc.):
hyperagent setup- Testnet only. This version signs only on Hyperliquid testnet. It cannot touch your mainnet funds.
- Agent-wallet only — you never paste your main private key. HyperAgent uses Hyperliquid's native "agent wallet" feature. You generate an agent key on app.hyperliquid-testnet.xyz/API, sign one approval transaction with your main wallet, and paste only the agent key into the wizard. Hyperliquid's exchange enforces that agent keys cannot withdraw funds — only place and cancel trades.
- Revocable any time. If you ever want to cut off the bot, click "Revoke" on the same Hyperliquid page. No key rotation, no emails, one click.
Every second, HyperAgent:
- Watches — Pulls live prices, funding rates, open interest, and orderbook depth from Hyperliquid mainnet
- Listens — Polls HypeDexer's full liquidation firehose (Hyperliquid-wide) for ongoing cascade events
- Thinks — Runs the active strategy's logic: scoring cascades, counting indicator votes, measuring orderbook imbalance, or calculating funding carry
- Decides — Only trades when the signal passes confidence thresholds AND risk checks
- Executes — Places market orders on Hyperliquid testnet instantly, sets native TP/SL as safety nets
- Protects — Monitors every position every 2 seconds with a trailing stop-loss that locks in profits
- Explains — When AI is on, Claude Haiku writes why the agent made each trade
┌──────────────────────────────────────────────────────────────────┐
│ HYPERAGENT TUI (Textual) │
│ [Dashboard] [Strategy Config] [Trade Journal] │
├──────────────────────────────────────────────────────────────────┤
│ │
│ STRATEGIES CORE │
│ ┌─────────────────────┐ ┌──────────────────────────────┐ │
│ │ Trend Follower │ │ Dual Client │ │
│ │ Momentum │─────>│ Mainnet Info (read-only) │ │
│ │ Funding Carry │ │ Testnet Exchange (trading) │ │
│ │ Volatility Breakout │ └──────────────────────────────┘ │
│ │ Pairs Reversion │ ┌──────────────────────────────┐ │
│ │ Liquidation Cascade │ │ Risk Manager │ │
│ └─────────┬───────────┘ │ Trailing stop (software) │ │
│ │ │ Native TP/SL (exchange) │ │
│ ┌─────────▼──────────┐ │ Daily loss limits │ │
│ │ AI Wrapper │ │ Position sizing │ │
│ │ (Claude Haiku via │ └──────────────────────────────┘ │
│ │ AWS Bedrock) │ │
│ └────────────────────┘ │
│ │
│ LIQUIDATION DATA TUI │
│ ┌────────────────────┐ ┌──────────────────────────────┐ │
│ │ HypeDexer Client │ │ Market Ticker │ │
│ │ Full liquidation │ │ Liquidation Stats (v2) │ │
│ │ firehose (30s) │ │ AI Reasoning Panel │ │
│ │ Rolling aggregator │ │ Positions + Trailing Stop │ │
│ └────────────────────┘ │ Scrollable Trade Log │ │
│ └──────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘
| Strategy | What It Does | Speed |
|---|---|---|
| Trend Follower | ADX(14) on 4h candles confirms trends, +DI/-DI for direction, EMA(21/55) confirms, pullback-to-EMA entries with ATR-based stops | Every 15s |
| Momentum | 6-signal weighted scoring (RSI, MACD+slope, EMA crossover, BB %B, volume-momentum, 4h confirmation) with ADX chop filter | Every 15s |
| Funding Carry | Research-calibrated funding arbitrage — requires >0.03% rate, settlement timing, trend filter, and funding persistence | Every 15s |
| Volatility Breakout | Detects Bollinger squeeze (BB inside Keltner), then trades the breakout with ATR-adaptive thresholds and volume confirmation | Every 15s |
| Pairs Reversion | Market-neutral stat-arb on BTC/ETH and SOL/AVAX — z-score on log price ratio, entry at 2σ, stop at 3.5σ | Every 15s |
| Liquidation Cascade | Polls HypeDexer's full liquidation firehose, trades in-cascade direction when dominant-side USD + 3× imbalance + 1.3× acceleration all confirm an ongoing cascade | Every 15s |
AI Layer: Any strategy can be wrapped with Claude Haiku (AWS Bedrock) for natural language trade explanations. Toggle with a key.
git clone https://github.com/yashj09/Hyperagent
cd hyperagent
python3 -m venv venv && source venv/bin/activate
pip install -e .
hyperagent| Key | Action |
|---|---|
d |
Dashboard |
s |
Strategy Config |
j |
Trade Journal |
n |
Analytics |
a |
Toggle AI |
k |
Kill all positions |
q |
Quit |
| Variable | Required | Description |
|---|---|---|
HL_MAIN_ADDRESS |
Yes | Your main wallet address (0x…, public) |
HL_AGENT_PRIVATE_KEY |
Yes | Agent wallet private key from Hyperliquid — never your main key |
AWS_ACCESS_KEY_ID |
For AI | AWS credentials for Bedrock |
AWS_SECRET_ACCESS_KEY |
For AI | AWS secret key |
AWS_DEFAULT_REGION |
For AI | AWS region (default: us-east-1) |
HYPEDEXER_API_KEY |
For Cascade v2 | Required only for the Liquidation Cascade v2 strategy |
HYPERAGENT_ENV_FILE |
No | Override config file location |
Price Feed (5s) ──> Prices, Funding, OI ──> Shared State
Liq Poller (30s) ──> HypeDexer firehose ──> Rolling Stats ──> Shared State
Strategy (15s) ──> Read State ──> Generate Signal ──> Execute Trade
Risk Monitor (2s) ──> Check Trailing Stops ──> Close on Breach
Dashboard (1s) ──> Read State ──> Render All Panels
- Liquidation Cascade Trader — Trades the full Hyperliquid liquidation firehose (via HypeDexer) when dominant-side USD, imbalance, and acceleration all confirm an ongoing cascade — catching the forced-flow move, not guessing at it
- Strategy platform, not a single bot — 6 strategies in a dropdown. Adding a new one is one file implementing
generate_signal() - AI reasoning on any strategy — Claude Haiku explains every trade in plain English
- Dual-network architecture — Real mainnet data, safe testnet execution
- Interactive TUI — Tabs, dropdowns, toggles, scrollable logs, keyboard shortcuts. Not a script — a terminal app
- Production risk management — Double stop-loss, per-coin dedup, daily loss limits, position sizing
| Library | Purpose |
|---|---|
| Textual 8.2.3 | Interactive TUI framework |
| hyperliquid-python-sdk 0.23.0 | Exchange API |
| ta | Technical analysis indicators (RSI, MACD, EMA, BB) |
| anthropic + boto3 | Claude Haiku via AWS Bedrock |
| numpy | Numerical computation |
| Python 3.9+ | Runtime |
hyperagent/
├── app.py # Textual App — entry point + background workers
├── config.py # All tunable constants
├── core/
│ ├── client.py # Dual Hyperliquid client (mainnet read + testnet trade)
│ ├── risk.py # Risk manager (trailing stop + native TP/SL + limits)
│ ├── state.py # Shared AgentState dataclass
│ ├── hypedexer_client.py # HypeDexer API client (liquidation firehose)
│ └── liquidation_aggregator.py # Rolling per-coin liquidation stats
├── strategies/
│ ├── base.py # Abstract BaseStrategy interface
│ ├── trend_follower.py # ADX-based CTA trend follower
│ ├── momentum.py # 6-signal weighted momentum
│ ├── funding_sniper.py # Funding carry arbitrage
│ ├── volatility_breakout.py # Bollinger/Keltner squeeze breakout
│ ├── pairs_reversion.py # Market-neutral pairs stat-arb
│ ├── liquidation_cascade_v2.py # Tradable cascade on HypeDexer firehose
│ └── ai_wrapper.py # Claude Haiku reasoning wrapper
├── tui/
│ ├── styles.tcss # Textual CSS (dark trading theme)
│ ├── screens/
│ │ ├── dashboard.py # Live dashboard
│ │ ├── strategy_config.py # Strategy selector + AI toggle + params
│ │ └── trade_journal.py # Trade history table + stats
│ └── widgets/
│ ├── market_ticker.py # Live price ticker bar
│ ├── liquidation_stats.py # Per-coin v2 liquidation stats panel
│ └── positions_panel.py # Active positions with trailing stop viz
├── requirements.txt
├── .env.example
└── .gitignore