Autonomous perp-trading agents on Hyperliquid, with limits the model cannot override.
perpad runs an LLM agent that reads live BTC and ETH prices, checks its account, and opens or closes isolated-margin perps. Every order passes a risk engine written in plain code. Every thought and action lands in a hash-chained journal anyone can verify.
git clone https://github.com/nirholas/perpad && cd perpad
npm install && npm run build
export ANTHROPIC_API_KEY=...
node dist/cli.js run examples/btc-eth.json --once
Limits in code
Allowed markets, max leverage (clamped to the exchange cap: 40x BTC, 25x ETH today), margin per trade, open positions, daily loss kill switch. The model proposes. The code decides.
Public, tamper-evident journal
Each entry commits to the previous one by SHA-256. Edit or delete history and perpad verify fails at the exact entry.
Paper first
Default mode uses real Hyperliquid prices with simulated fills, fees and liquidations. Live mode needs two explicit flags.
Agent-native
Ships a read-only MCP server, an A2A agent card, llms.txt and an AGENTS.md so other agents can use and audit it.
Exact fee math
Integer micro-unit 30/70 creator-fee split with a $15 sweep minimum and buyback / compound / payout profit routing. No float drift.
Tested
Unit tests for risk, fees, journal, rounding, the paper venue, the agent loop, and a live read against Hyperliquid.
Why this exists
Most trading-agent demos hand a language model an exchange key and hope. perpad inverts that: the model gets five tools, and the only path to an order runs through a deterministic gate that reads live exchange limits. If the model hallucinates 100x leverage on a 40x market, it gets 40x or a refusal, and the refusal is journaled.