Skip to content

raintree-technology/perps

perps

Universal perpetual futures platform. One CLI, 11 exchanges, structured JSON output designed for AI agents.

Rust CI Release License: MIT

Install

# macOS / Linux
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/raintree-technology/perps/releases/latest/download/perps-installer.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://github.com/raintree-technology/perps/releases/latest/download/perps-installer.ps1 | iex"

Or download binaries directly from GitHub Releases.

Pre-built binaries are available for macOS (Intel + Apple Silicon), Linux (x86_64 + ARM64), and Windows (x86_64).

Quick Start

# Build from source (alternative to install above)
cargo build --release

# See what's connected
cargo run -p perps-cli -- connector ls
cargo run -p perps-cli -- ops doctor

# Market data
cargo run -p perps-cli -- universe list
cargo run -p perps-cli -- market ticker BTC --connector hyperliquid
cargo run -p perps-cli -- market book BTC --connector hyperliquid
cargo run -p perps-cli -- funding scan --asset BTC

# Trading
cargo run -p perps-cli -- order submit hyperliquid BTC-PERP long --type limit 0.01 --limit-price 50000
cargo run -p perps-cli -- order open --connector hyperliquid
cargo run -p perps-cli -- account positions --connector decibel

# Agent-friendly (structured JSON output)
cargo run -p perps-cli -- --json market ticker BTC --connector hyperliquid

Supported Exchanges

DEXes (8)

Exchange Chain Required Env Vars
Hyperliquid Arbitrum L2 HYPERLIQUID_WALLET_ADDRESS, HYPERLIQUID_PRIVATE_KEY
Decibel Aptos L1 DECIBEL_API_BEARER_TOKEN, DECIBEL_WALLET_ADDRESS, DECIBEL_PRIVATE_KEY
Aevo Ethereum AEVO_API_KEY, AEVO_API_SECRET, AEVO_SIGNING_KEY
Orderly Arbitrum / Optimism / Polygon / Base ORDERLY_ACCOUNT_ID, ORDERLY_SECRET_KEY
Paradex StarkNet L2 PARADEX_JWT, PARADEX_ACCOUNT_ADDRESS
dYdX V4 Cosmos DYDX_ADDRESS, DYDX_REST_URL
Vertex Arbitrum VERTEX_REST_URL, VERTEX_WS_URL
GMX V2 Arbitrum GMX_REST_URL

CEXes (3, via CCXT)

Exchange Required Env Vars
Binance USDM BINANCEUSDM_API_KEY, BINANCEUSDM_API_SECRET
Bybit BYBIT_API_KEY, BYBIT_API_SECRET
OKX OKX_API_KEY, OKX_API_SECRET, OKX_PASSPHRASE

CEX connectors are configured via PERPS_CCXT_EXCHANGES (defaults to binanceusdm,bybit,okx).

See .env.example for the full list of environment variables. Exchange-specific onboarding guides are in docs/exchanges/.

Command Surface

15 command namespaces, 80+ subcommands. Every command supports --json for machine output, --dry-run for safety, and --help for usage.

Namespace Commands
universe list, resolve, venues, constraints, map, canonicalize, schema-version
funding scan, history, rates, schedule, basis, caps, compare, opportunities
market ticker, book, stream, snapshot, fees, margin, trades
account balances, positions, orders, state, health, exposure, margin
order submit, cancel, amend, verify, open, position, batch-place, batch-cancel, cancel-all-after, mmp, twap, preview, status, fills, cancel-by-client-id
arb funding
connector ls, health, scorecard
risk evaluate, show, rules, simulate, lock, unlock, set, override
ops doctor, connectors, auth-check, rate-limits, latency, circuit-breakers, incidents, dependencies
gateway serve
journal ls, show, stats, get, tail, integrity-check
pair submit, status, unwind, list
portfolio nav, stress
sim start, status, stop, account, config, export, assertions
tui (launches terminal dashboard)

Global flags: --json, --dry-run, --request-id, --strategy-id, --max-position-pct, --max-order-notional, --max-drawdown-pct, --max-leverage.

Architecture

Architecture

21 crates in the workspace. Three entry points (CLI, Gateway, TUI) share the same perps-app core.

All JSON responses are wrapped in a ContractEnvelope<T> with request_id, asof_ts, strategy_id, and typed error codes with is_retryable(). Streaming uses NDJSON StreamFrame<T>.

Exit Codes

Code Meaning
0 Success
1 Unknown error
2 Validation error
3 Not found
4 Auth/credential error
5 Rate limited
6 Unavailable
7 Execution error
8 Partial execution
10 Timeout

Security

  • Env vars only — credentials load from environment variables, never stored in config files
  • No telemetry — your keys and trades stay on your machine
  • Dry-run by default — use --dry-run to preview any order before execution
  • Risk policy — pre-trade checks on position size, leverage, drawdown, and notional limits

Development

git clone https://github.com/raintree-technology/perps.git
cd perps

# Build
cargo build

# Check
cargo clippy --workspace
cargo test --workspace

# Run
cargo run -p perps-cli -- --help
cargo run -p perps-gateway -- --host 127.0.0.1 --port 4020
cargo run -p perps-tui

Requires Rust stable toolchain (see rust-toolchain.toml).

Contributing

See CONTRIBUTING.md for guidelines.

Author

Raintree Technology

License

MIT | Changelog

Disclaimer

This software is provided as-is. Trading perpetual contracts involves substantial risk of loss and is not suitable for every investor. The authors and contributors are not responsible for any financial losses, missed trades, or other damages arising from the use of this software. You are solely responsible for your own trading decisions and for securing your own private keys. Use at your own risk.

About

Agent-first CLI for perpetual futures trading across 11 exchanges. Structured JSON contracts, multi-stage risk evaluation, normalized funding analytics, and idempotent order execution — built in Rust.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors