perp-cli
The perp-cli MCP server provides market/account data, funding and P&L analytics, trade preview/execution, and CLI guidance across multiple perpetual-futures venues.
Query market data: markets, order books, cross-exchange prices, verified/unverified funding rates, Hyperliquid Outcome markets/books, and Derive options data.
Read account data: balances, positions, open orders, portfolio/risk summaries, and keyless lookups by public address on supported venues.
Analyze performance: funding income, net P&L by exchange, and side-by-side active arbitrage position comparison.
Scan funding-rate arbitrage opportunities with symbol and minimum-spread filters.
Preview trades read-only with validation, estimated fill/notional, margin impact, builder fee, and risk/quarantine checks.
Execute real market/limit trades and close positions, with confirmation expectations, risk-limit refusals, order status outcomes, and execution logging.
Access Pacifica-specific data: Print products, Print quote validation, Print positions/history, and vault data.
Use productivity tools: natural-language CLI command suggestions, command explanations, portfolio summaries, and venue health/latency checks.
Supports perpetual futures trading, market data access, and account management on Ethereum-based exchanges such as Lighter.
Enables interaction with Solana-based perpetual futures exchanges like Pacifica for trading, portfolio management, and market analysis.
Provides tools to configure and manage automated funding rate alerts via a Telegram bot and background daemon.
Facilitates background job management for long-running trading bots and alert systems using tmux sessions.
perp-cli
One CLI for perpetual futures across many DEXs — trade, compare funding, move funds and run bots from the terminal, or hand it to an AI agent (JSON output, MCP server, agent skill).
Trade on 10 venues: Hyperliquid (incl. HIP-3 dexes), Pacifica, Lighter, Lighter RH, Aster, Ondo Perps, Arcus, QFEX, RISEx, TxFlow (bridge and perp-perp arb cover the original four: Pacifica, Hyperliquid, Lighter, Aster)
Market data only: GRVT, Extended, Variational — plus Derive options data
Install
npm install -g perp-cli
perp --version
# Or without a global install
npx -y perp-cli --json portfolioThe package ships three executables: perp (the CLI), perp-mcp (the MCP server, stdio) and perp-guardrail (the signing guardrail).
Related MCP server: dex-kline-mcp
Quick start
1. Look around — no keys needed.
perp -e hl market list # markets, prices, funding
perp -e hl market book BTC # order book
perp arb scan --rates # funding rates across venues2. Add a wallet. The setup wizard creates or imports an encrypted OWS vault wallet, picks venues and registers agent keys (it asks before every signature and never moves funds):
perp setup
perp wallet showKeys are read from a hidden prompt or stdin — never from argv or ~/.perp/.env. One EVM key covers Hyperliquid, Lighter and Aster. For other paths (one-line key import, scriptable setup, keys created on the exchange website) see docs/setup.md.
3. Check your account and trade. Add -n testnet to any command to use testnet.
perp --json portfolio # balances + positions + risk on every venue
perp --json --dry-run -e hl trade market BTC buy 0.001 # validate only, nothing is sent
perp --json -e hl trade market BTC buy 0.001 # market order (bounded by the slippage setting)
perp --json -e hl trade close BTCAI Agent Skill
Drop-in skill for Claude Code, Cursor, Codex, Gemini CLI, and other agent CLIs. Bundles a non-interactive command guide, ops playbook, strategy framework, and reusable shell scripts (preflight, arb monitor, validation) so your agent stops at the right confirmation points and never wedges on interactive wizards.
Install
# Claude Code — slash command
/install-skill hypurrquant/perp-cli
# Cursor / Codex / generic agent CLIs — via npx
npx skills add hypurrquant/perp-cli
# Manual install (any agent that reads a Skills directory)
git clone https://github.com/hypurrquant/perp-cli.git
cp -R perp-cli/skills/perp-cli ~/.claude/skills/ # or your CLI's skills dirThe skill ships inside the npm package (perp-cli/skills/perp-cli), so a global install also makes it available locally:
npm install -g perp-cli@latest
ls "$(npm root -g)/perp-cli/skills/perp-cli"What's in the skill
File | Purpose |
| Top-level agent guide — rules, workflows, examples |
| Full non-interactive command reference (every group) |
| Setup flows, idempotency, error handling, common mistakes |
| Funding-arb decision framework + risk management |
| Install + wallet + connectivity + risk readiness check |
| Live monitor for open arb positions |
| Scan spot+perp opportunities with balance context |
| Cross-exchange funding overview / per-symbol drilldown |
| Pre-execution validation (price / balance / risk / dry-run) |
See skills/perp-cli/SKILL.md for the full agent guide.
Features
Funding rate arb — perp-perp and spot-perp scans, one-command dual-leg entry and exit
Portfolio — one call returns balances, positions and risk across every venue
Funds — deposit, withdraw, transfer, multi-provider bridge (CCTP / Relay / deBridge), inter-exchange rebalance
Bots — TWAP, grid, DCA, trailing stop and more, with background job management
Agent-first —
--json,--fields,--ndjson,--dry-run, runtime schema introspectionSafety — pre-trade validation, a slippage bound on every market order, client-id deduplication, response sanitization
Venues
Venue |
| Trading | Chain / collateral |
Hyperliquid |
| ✅ | HyperEVM, USDC; HIP-3 dexes via |
Pacifica |
| ✅ | Solana, USDC |
Lighter |
| ✅ | Ethereum L2, USDC |
Lighter RH |
| ✅ | Robinhood chain, USDG |
Aster |
| ✅ | BNB Chain, USDT / USDC |
Ondo Perps |
| ✅ | off-chain, USDC |
Arcus |
| ✅ (access whitelist) | Robinhood chain, USDG |
QFEX |
| ✅ (manual trading only) | custodial; equities, indices, commodities |
RISEx |
| ✅ (manual trading only; mainnet not yet verified) | RISE chain, USDC |
GRVT |
| market data only | USDT |
Extended |
| market data only | Starknet; crypto + equities / FX |
Variational |
| market data only | RFQ venue |
TxFlow |
| ✅ (manual trading only; mainnet not yet verified, whitelist) | official API (Beta), USDC |
Derive |
| options data only | — |
Support matrix and per-venue notes — funding, WebSocket, deposit / withdraw, lookups by address, restricted regions
Mainnet verification — which features have been run with real money
Trading details — time in force, TP/SL, stops, slippage, spot trading, builder fees
Common commands
# Market data
perp --json -e <EX> market list | book <SYM> | funding <SYM> | kline <SYM> 1h
# Trading
perp --json -e <EX> trade buy <SYM> <SIZE> --tp <PX> --sl <PX> # entry protected by TP/SL
perp --json -e <EX> trade limit <SYM> buy <PX> <SIZE>
perp --json -e <EX> trade close <SYM> # or: flatten (every position)
# Account
perp --json portfolio
perp --json -e <EX> account positions
perp --json account balance --address <ADDR> # any account, keyless
# Funding arb
perp --json arb scan --min 5
perp --json arb exec <SYM> <longEx> <shortEx> <USD>
# Funds
perp --json funds deposit hyperliquid 100
perp --json funds bridge send --from solana --to arbitrum --amount 100Full list with every group: docs/commands.md. Global flags: --json, --fields <f>, --ndjson, --dry-run, -n testnet, -e <venue>, --dex <name> (HIP-3), -w, --wallet <name>.
Command Groups
Group | Description |
| Prices, orderbook, funding, klines, HIP-3 dexes |
| Balance, positions, orders, margin |
| Market/limit/stop orders, close, scale, split execution |
| Hyperliquid Outcome (HIP-4) — binary/range contracts, quoted per outcome (outcomeMeta |
| Options market data, read-only (Derive: |
| Pacifica Print — strike orders earning a premium per cycle: games, quote, positions, history, events, deposit / cancel ( |
| Pacifica vaults (API: lakes) — list, info, positions, deposit (master wallet only) / withdraw ( |
| Funding rate arb — scan, exec, close, monitor (perp-perp & spot-perp) |
| 19 bot algorithms (grid, dca, twap, APEX, REFLECT, presets) + nested scripted plans |
| Deposit, withdraw, transfer, cross-chain bridge (multi-provider), inter-exchange rebalance |
| Risk limits, liquidation distance, guardrails |
| Multi-wallet management, agent wallets ( |
| Execution log, PnL, performance breakdown |
| Cross-exchange unified overview (replaces former |
| Adapter health check: ping every venue's REST endpoint (connectivity + latency) |
| CLI settings (referrals, defaults, fees, builder fees, deBridge affiliate) |
| Strategy backtesting |
| Background process supervisor (tmux sessions for strategies, alerts, etc.) |
| Funding rate alerts (Telegram / Discord) with background daemon |
| Setup wizard: OWS wallet, venues, agent wallets, slippage, default venue (alias: |
Agent-First CLI Design
Built following agent-first CLI principles:
# Every command returns structured JSON envelope
perp --json portfolio
# → { "ok": true, "data": {...}, "meta": { "timestamp": "..." } }
# Filter output to specific fields (saves tokens)
perp --json --fields totalEquity,risk portfolio
# Stream large lists as NDJSON (one JSON per line)
perp --json --ndjson -e hl market list
# Pre-validate before executing
perp --json -e hl trade check BTC buy 0.01
perp --json --dry-run -e hl trade market BTC buy 0.01
# Idempotent orders with client ID (Hyperliquid: a 128-bit cloid, 0x + 32 hex; --auto-id generates one)
perp --json -e hl trade market BTC buy 0.01 --client-id 0x1234567890abcdef1234567890abcdef
perp --json -e hl trade status c:0x1234567890abcdef1234567890abcdefAll responses are auto-sanitized (control chars stripped, prompt injection patterns blocked).
Errors include retryable flag — only retry when true.
MCP Server
perp-mcp serves 31 tools to Claude Desktop, Cursor and other MCP clients. Market data needs no keys; for account and trading tools run perp setup first (the server reads the same wallet). Never put private keys in the MCP config.
{
"mcpServers": {
"perp-cli": {
"command": "npx",
"args": ["-y", "-p", "perp-cli", "perp-mcp"]
}
}
}Testnet, the full tool list, resources and prompts: docs/mcp.md.
Documentation
Doc | What's in it |
Wallets, agent keys, keys created on the exchange website, where secrets are stored | |
Support matrix, venue ids, QFEX / RISEx / GRVT / Extended / Variational / TxFlow / Derive details | |
Time in force, TP/SL, stops, order edit, slippage, spot trading, builder fees | |
Every command group with examples, Telegram alerts | |
What has been run with real money, per venue | |
Configuration, testnet, tools, resources, prompts | |
| |
Test suites and the venue checklist | |
Release notes |
License
MIT
Available Tools
31 toolsarb_scanA
Scan for funding rate arbitrage opportunities across exchanges. Finds symbols with the largest funding rate spreads
Inputs: symbols, minSpread.
explain_commandA
Explain what a perp CLI command does, its parameters, and any risks. Helps the user understand a command before running it
Inputs: command (required).
get_arb_compareA
Compare active arbitrage positions side by side — ROI, funding income, price PnL, and annualized returns for each position
Inputs: period.
get_balanceA
Get account balance (equity, available margin, margin used, unrealized PnL) on an exchange. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: exchange (required).
get_balance_by_addressA
Balances of ANY account by its public address — keyless, read-only (public venue data; nothing is signed, no key is needed). Venues: pacifica (base58 Solana address), hyperliquid (0x address), lighter (0x address), lighter-rh (0x address), risex (0x address); omit exchange to read every one of them (a venue that fails, address format included, is listed in data.errors). data: { balance (equity / available / marginUsed / unrealizedPnl + venue extras; null on Lighter), spot (token balances; null where the venue does not publish them), accounts (Lighter: one row per account of the address; accountIndex narrows), dexes + accountMode (Hyperliquid: HIP-3 dexes with a non-zero account value; a dex that fails is in meta.errors / meta.warnings — unknown, not zero) }. Other venues: CAPABILITY_UNSUPPORTED; a wrong address format: INVALID_PARAMS. Same data as perp [-e <venue>] account balance --address <addr>.
Inputs: address (required), exchange, accountIndex.
get_funding_analysisA
Analyze funding income across exchanges — cumulative totals, annualized rates, and per-arb-position breakdown. Great for tracking funding arb profitability.
Inputs: period, symbol, exchange.
get_funding_ratesA
Compare funding rates across every market-data venue whose funding rate is verified. Returns rates per symbol with spread analysis. includeUnverified also returns venues whose rate is unverified (QFEX; TxFlow — rate not checked against settled payments; Variational — a predicted rate not checked against settled payments; GRVT — indicative rate; Extended — not checked against settled payments), each row tagged fundingVerified / apiStatus — display only, never a basis for trading (mirrors the CLI arb scan --include-unverified).
Inputs: symbols, minSpread, includeUnverified.
get_marketsA
Get all available perpetual futures markets on an exchange, including price, funding rate, volume, and max leverage. Works without API keys (public market data). Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: exchange (required).
get_open_ordersA
Get all open/pending orders on an exchange. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: exchange (required).
get_option_chainA
Option chain for one expiry (Derive): rows per strike with call and put quotes — bid / ask (price + size; null = empty side), mark, index, forward, IV (mark / bid / ask; null = not computable), greeks (delta, gamma, theta, vega, rho), open interest, 24h volume — plus the ATM strike. Decimals are strings. One venue request per expiry. Public read.
Inputs: venue (required), underlying (required), expiry, strikes.
get_option_expiriesA
List the active option expiries of an underlying on an options venue (Derive): per expiry the UTC date (YYYY-MM-DD), expiry ms, strike and instrument counts, soonest first. Public read — no API key needed.
Inputs: venue (required), underlying (required).
get_option_quoteA
Quote one option instrument (Derive name, e.g. ETH-20261225-3500-P): bid / ask (price + size), mark, index, forward, IV, greeks, open interest, 24h stats. Unknown instrument → SYMBOL_NOT_FOUND. Public read.
Inputs: venue (required), instrument (required).
get_orderbookA
Get the order book (bids and asks) for a symbol on an exchange. Works without API keys on every venue with an account API (configured credentials → the account adapter; none → the public endpoint / read-only adapter); market-data-only venues have no orderbook path. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: symbol (required), exchange (required).
get_outcome_bookB
Get the orderbook for one outcome side. Public read — no API key needed.
Inputs: side (required), outcome (required).
get_outcome_marketsA
List active Hyperliquid Outcome markets (HIP-4). Each market has parsed metadata (underlying asset, target price, expiry, period) and per-side info (Yes/No name, encoding, asset id, current mid). Public read — no API key needed.
Inputs: no named parameters.
get_outcome_positionsA
Get the active account's open outcome positions (size, entry notional, mark price, unrealized PnL). Requires a configured Hyperliquid wallet or agent.
Inputs: no named parameters.
get_outcome_viewA
Get a combined view of one outcome market: all sides' books in parallel + underlying mark price gap (vs targetPrice) + time to expiry + per-side implied probability (mid sum). For binary markets, the symmetric structure means Yes bid + No ask ≈ 1.0 — the view exposes both sides in a single round-trip and surfaces directional context (e.g., is BTC currently above the target). Public read.
Inputs: outcome (required), depth.
get_pnl_analysisA
P&L analysis combining trading fees and funding income — shows net profit/loss by exchange with daily breakdown
Inputs: period, exchange.
get_positionsA
Get all open positions on an exchange, including size, entry price, PnL, leverage. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: exchange (required).
get_positions_by_addressA
Open positions of ANY account by its public address — keyless, read-only (public venue data; nothing is signed, no key is needed). Venues: pacifica (base58 Solana address), hyperliquid (0x address), lighter (0x address), lighter-rh (0x address), risex (0x address). Hyperliquid reads the native dex and every HIP-3 dex (rows carry dex: null | ""; a dex that fails is listed in meta.errors / meta.warnings — its rows are missing, not absent); Lighter reads every account of the address (rows carry accountIndex; accountIndex narrows). Other venues: CAPABILITY_UNSUPPORTED; a wrong address format: INVALID_PARAMS. Same rows as perp -e <venue> account positions --address <addr>.
Inputs: address (required), exchange (required), symbol, accountIndex.
get_pricesB
Get cross-exchange prices for symbols. Fetches mark prices from every market-data venue for comparison; a venue appears in a row only when it lists that symbol (e.g. QFEX lists no BTC). Each row's unofficialApiVenues names the venues in it read through an undocumented API (none at present) — like get_markets' venueApi tag.
Inputs: symbols.
health_checkA
Ping every registered venue on the server's network and return connectivity status and latency. Pacifica / Hyperliquid / Lighter / Aster / QFEX: REST ping (status = HTTP status, 0 = no response); every other venue: its public market-data read (status null). A failure carries its error message.
Inputs: no named parameters.
pacifica_print_positionsB
Pacifica Print orders of an account (read-only): current orders, or with history=true every order (paginated: limit / cursor). Status printing | cancelling | filled | liquidated | cancelled | completed | ended.
Inputs: account (required), limit, cursor, history.
pacifica_print_productsA
Pacifica Print products (read-only): game id (e.g. BTC_24H, BTC_7D, BTC_1M), cycle length in days, max leverage, deposit caps, allowed target distance from mark. Print = a strike order that earns a premium each cycle; while resting it fills / is liquidated only at a cycle checkpoint, after a fill it is an ordinary perp position (continuous liquidation).
Inputs: no named parameters.
pacifica_print_quoteA
Validate a Pacifica Print order and preview it (read-only, nothing signed): notional, size on fill, docs-formula liquidation price (an outer bound — a liquidation was observed earlier in one live case; venue trigger unpublished), max loss (deposit + premiums), lock period. The premium is not quoted (the venue's preview is a signed request). Placing the order is CLI-only: perp -e pacifica print deposit … (supports --dry-run).
Inputs: game (required), strike (required), deposit (required), leverage (required), +2 more.
pacifica_vaultsA
Pacifica vaults (API: lakes), read-only. Without vault: every vault (TVL, NAV per share, fee, lock-up, withdrawal window, config); with account: plus that account's shares. With vault (address, or a nickname matching exactly one vault — an ambiguous nickname is INVALID_PARAMS listing the candidates): one vault plus live account equity, positions, deposit whitelist (unofficial endpoint, advisory) and whether withdrawals are open now. APY is not published (null). Deposits / withdrawals are CLI-only: perp -e pacifica vault deposit|withdraw (supports --dry-run).
Inputs: vault, account.
portfolioA
Cross-exchange portfolio summary: balances, positions, and risk metrics across all exchanges with configured credentials
Inputs: no named parameters.
suggest_commandA
Given a natural language trading goal, suggest the exact perp CLI commands to run. Does NOT execute anything — only returns commands for the user to review and run manually
Inputs: goal (required), exchange.
trade_closeA
Close an existing position. IMPORTANT: Call trade_preview first with the opposite side to show impact, then get user confirmation. Verified close: closedSize is the measured / venue-final fill (one residual market close is attempted); a residual still open → ORDER_PARTIAL error (symbol quarantined). Includes the uniform OrderResult of the reduce-only market order. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: symbol (required), exchange (required).
trade_executeA
Execute a REAL trade on the server's network (meta.network; PERP_NETWORK, default mainnet). IMPORTANT: Always call trade_preview first and get explicit user confirmation before calling this tool. Refused with RISK_VIOLATION when the order breaches the local risk limits (perp risk set; there is no override over MCP) or when the symbol is quarantined (only reduce-only orders pass). Every order is written to the execution log. Supports market and limit orders. Returns the uniform OrderResult (status, finality, filledSize, execution: slippage / protection price / TIF sent) with the raw venue response under legacy, plus top-level filledSize / requestedSize / partial. Outcomes: an unknown outcome (transport failure after send, or a non-final venue ack) → ok:false, code ORDER_PENDING, executed:false, pending:true and a "do NOT resubmit" remediation — the symbol is quarantined for opening orders until a human clears it; a final rejection / cancel with nothing filled → ORDER_REJECTED, executed:false; a cancel after a partial fill → executed:true, partial:true with the real filledSize. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: side (required), size (required), symbol (required), exchange (required), +5 more.
trade_previewA
Preview a trade WITHOUT executing. Runs trade_execute's pre-send checks read-only (size parse, order validation incl. TIF, quarantine, local risk limits — never forced) and reports any refusal as valid:false with its code + remediation; also returns the estimated fill price from the book, notional, margin impact, the builder fee the order would carry, and the existing position. Venue trading fees are NOT estimated. ALWAYS call this before trade_execute and show the result to the user for confirmation. Hyperliquid: native perps only (HIP-3 dexes via the CLI --dex).
Inputs: side (required), size (required), symbol (required), exchange (required), +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 31 tools
Most tools target distinct resources, but several clusters overlap: get_funding_rates / get_funding_analysis / arb_scan / get_arb_compare all concern funding and arbitrage, and get_positions / get_positions_by_address / get_outcome_positions require careful reading to distinguish. The by-address variants and the outcome view/book/markets trio are also close enough to invite misselection.
All names are snake_case and most use a get_ or trade_ verb prefix, but conventions are mixed: pacifica_print_* and pacifica_vaults use a venue prefix, arb_scan and health_check reverse to noun_verb, and portfolio/suggest_command/explain_command break the pattern. Readable, but not a predictable verb_noun scheme throughout.
31 tools is heavy for a perpetual-futures CLI server and several sit in overlapping analysis or venue-specific niches (Pacifica Print has three tools alone). The surface could be consolidated without losing capability.
Core workflows are covered — market data, account/position reads, trade preview/execute/close, funding and PnL analysis, options and outcomes. However, there is no cancel_order tool despite get_open_orders, and no order-status/history or leverage/margin modification, which are notable gaps for a trading server.
Maintenance
Related MCP Connectors
23-in-1 MCP server: EVM tx simulator, funding rate arb, macro radar, swap calldata & security.
Hyperliquid, Binance & Bybit perpetual funding rate arbitrage & DeFi APY yield scanner MCP.
Live perp funding rates across 6 venues (Hyperliquid, Binance, Bybit, Lighter...) and arbitrage.
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that provides real-time data and insights from the Hyperliquid perp DEX for use in bots, dashboards, and analytics.1730MIT
- AlicenseAqualityDmaintenanceAn MCP server that streams K-line (candlestick) data from decentralized exchanges (DEXs) to power your AI agents and workflows.14MIT
- AlicenseAqualityDmaintenanceEnables AI agents to trade leveraged perpetual futures on Solana's Jupiter Perpetuals while providing tools for market data and technical analysis. It supports portfolio management, fee estimation, and automated position execution for SOL, ETH, and BTC using USDC collateral.132MIT
- AlicenseNot gradedqualityNot gradedmaintenanceAI-to-AI marketplace MCP server with 46 tools — swap 65+ crypto tokens on 7 chains, rent GPUs, trade 25 tokenized stocks, on-chain escrow (Solana + Base), DeFi yields, sentiment analysis, wallet monitoring, and image generation. Supports USDC payments across 14 blockchains.MIT