A small Hyperliquid trading bot in Python. It reads candles and liquidations from Ironflow, Hyperliquid market data from our own nodes, and trades through the official Hyperliquid Python SDK. It runs as a dry run by default, with no key and no wallet.
pip install -r requirements.txt
python bot.py --onceOr in one command with uv: uv run bot.py --once.
The first run prints the last hour of BTC liquidations, reads 15-minute BTC candles and prints the order it would send. It goes long when the 8-candle moving average of closes is above the 21-candle average, and short when it is below. Without --once it runs a pass every 15 minutes.
Dry run on BTC: no orders are sent
BTC-PERP last hour: $123,456 longs and $7,890 shorts liquidated (12 liquidations)
dry run: would buy 0.00324 BTC at market
13:13:53 close 61,794.0 signal long BTC +0.0
export HL_PRIVATE_KEY=0x... # an API wallet key from app.hyperliquid.xyz/API
export HL_ACCOUNT_ADDRESS=0x... # the account the API wallet trades for
python bot.py --trade testnet # Hyperliquid testnetStart on testnet. Use an API wallet, not your main private key: it can trade but cannot withdraw.
- Liquidations:
GET https://api.ironflow.sh/v1/liquidations/summary?market=BTC-PERP&windows=1h, long and short USD liquidated in the last hour. - Signals:
GET https://api.ironflow.sh/v1/candles, built from every Hyperliquid fill. - Orders: the SDK's
Exchange.market_open, one order to reach the target position.
To change the strategy, edit the settings at the top of bot.py (COIN, INTERVAL, FAST, SLOW, SIZE_USD) or replace signal().
Without a key: 30 requests a minute and 100 credits a day per IP, and 24 hours of history. A candle read costs 1 credit and the liquidation summary 5, so a pass every 15 minutes fits. A free key from ironflow.sh/key gives 1,000 credits a day and 14 days of history:
export IRONFLOW_KEY=if_your_keyPlans for more history and higher limits: Explorer $49, Builder $149 and Pro $499 a month.
This is an example, not trading advice.
- Ironflow API docs
- Liquidation alerts to Discord, Slack, Telegram or a webhook
- Hyperliquid MCP server for Claude, Cursor and other agents
MIT