Skip to main content

By Zach

Perps CLI: Universal CLI for Perpetual DEXes

Perps is an open source perpetual DEX CLI for Hyperliquid, Aevo, Decibel, Orderly, and Paradex, with JSON automation, arbitrage workflows, risk controls, and an encrypted local vault.

  • perps
  • cli
  • perpetual-dex
  • hyperliquid
  • arbitrage
  • risk-management
  • defi
  • trading
  • crypto
  • automation
  • ai

Perps is an open source perpetual DEX CLI for market data, execution, and automation.

The goal is simple: one command surface for data, trading, risk, and automation across multiple exchanges, without building a new integration every time.

Why we built this perpetual DEX CLI

Perp infrastructure is fragmented.

  • Every exchange has different auth models and APIs.
  • Teams rebuild the same market-data, order, and risk plumbing repeatedly.
  • Automation becomes brittle when command output is inconsistent.

Perps standardizes that layer with a single CLI and adapter interface.

What you get from Perps CLI

From the current repo:

  • Native adapters for Hyperliquid, Aevo, Decibel, Orderly, and Paradex
  • Raw passthrough to 100+ CEX/DEX venues via CCXT
  • Prediction-market access via PMXT (Polymarket, Kalshi, Limitless)
  • Agent-friendly JSON output and deterministic exit codes
  • Node package + TypeScript programmatic API

If you want the complete command and capability matrix, use the repo's CAPABILITIES.md as the source of truth.

Install:

npm install -g @raintree-technology/perps
perps --help

Quick start

# Guided onboarding (testnet by default)
perps setup wizard
 
# Market data
perps markets ls
perps markets ticker BTC
perps arb funding BTC
perps arb compare
 
# Orders
perps order market buy BTC 0.01 --idempotency-key demo-001
perps order limit sell ETH 0.25 3200 --idempotency-key demo-002
 
# Funding-rate arbitrage dry run
perps arb execute BTC -s 1000 --dry-run --yes

Agent-first automation for trading bots

Perps was designed for both humans and automation systems.

  • --json across command groups for machine-readable output
  • Schema-versioned payloads
  • Deterministic non-zero exit codes for failure classes
  • Idempotency keys on execution commands
  • HTTP agent gateway (perps agent serve) for bot integration

That makes it practical to wire into scripted workflows, evaluators, and autonomous agents.

You can quickly inspect gateway capabilities with:

perps agent serve
curl http://127.0.0.1:4020/capabilities

Security model for API keys and wallets

Credentials are treated as first-class operational risk:

  • Testnet by default (mainnet requires explicit opt-in)
  • AES-256-GCM encrypted local vault for stored secrets
  • Owner-only file permissions (chmod 600 files, chmod 700 directories)
  • Environment-variable based auth paths for CI and container workloads
  • No telemetry/phone-home behavior described in the project docs

Command surface beyond order placement

Perps covers more than basic place/cancel commands:

  • perps account for balances and positions
  • perps risk for rules, audits, patterns, anomalies
  • perps strategy for registered strategy introspection
  • perps signal for signal tracking
  • perps replay for execution replay
  • perps operator for halt/resume controls
  • perps doctor for health checks

For power users, advanced capabilities (batch operations, TWAP, MMP, cancel-all-after) are available where exchange adapters support them.

Programmatic usage

The package can also be imported directly in Node/TypeScript:

import { HyperliquidAdapter } from "@raintree-technology/perps/adapters"
 
const hl = new HyperliquidAdapter()
await hl.connect({ testnet: true })
 
const markets = await hl.getMarkets()
const ticker = await hl.getTicker("BTC-PERP")
 
await hl.disconnect()

Adapters implement a shared interface, so teams can swap exchanges without rewriting business logic from scratch.

Why this matters for trading teams

Perps is best thought of as execution infrastructure, not just a command-line toy.

You can use it for:

  • Manual operator workflows
  • Scripted market-data and risk checks
  • Agent-driven strategy loops
  • Unified exchange integration in internal tooling

If you work across multiple perp venues, a consistent CLI + adapter layer usually pays for itself quickly.

As with any trading infrastructure, run this with strict operational controls and start in testnet before moving to mainnet.