A command-line interface for Hyperliquid DEX — a direct 1:1 Rust port of the npm package hyperliquid-cli.
Features a beautiful terminal UI with real-time watch modes and an optional background caching server.
Note: this repo installs
rhl/rhl-server(to avoid clashing with the npmhlbinary). It uses the same local storage directory (~/.hl/) as the JS CLI.
Prereqs:
- Rust toolchain (install via
rustup) - Linux only: you may need OpenSSL +
pkg-config(fornative-tls)
cargo install hyperliquid-cliThis installs two binaries:
rhlrhl-server
Install from Git:
cargo install --git <REPO_URL> --lockedInstall from this repo (local):
cargo install --path .If rhl isn’t found after installing, make sure ~/.cargo/bin is on your PATH.
- Multi-Account Management - Store and manage multiple accounts locally with SQLite
- Real-Time Monitoring - WebSocket-powered live updates for positions, orders, balances, and prices
- Beautiful Terminal UI - Color-coded PnL, depth visualization, and interactive tables
- Trading Support - Place limit and market orders
- Scripting Friendly - JSON output mode for automation and scripting
- Testnet Support - Seamless switching between mainnet and testnet
| Option | Description |
|---|---|
--json |
Output in JSON format |
--testnet |
Use testnet instead of mainnet |
-V, --version |
Show version number |
-h, --help |
Show help |
Manage multiple accounts locally. Accounts are stored in a SQLite database at ~/.hl/hl.db.
Interactive wizard to add a new account:
rhl account add- Import API wallets from Hyperliquid for trading
- Add read-only accounts for monitoring only
- Set account aliases for easy identification
- Choose a default account for commands
rhl account lsShows all configured accounts with alias, address, type, and default status.
rhl account set-default <alias>Sets which account to use by default.
rhl account remove <alias>Interactively remove an account from local storage.
View account balances and portfolio with optional real-time watch mode.
# Spot + perpetuals balances
rhl account balances
# Watch mode - real-time updates
rhl account balances -w
# Specific address
rhl account balances --user 0x...Shows spot token balances (total, hold, available) and perpetuals USD balance.
# Positions + spot balances combined
rhl account portfolio
# Watch mode
rhl account portfolio -wCombined view of all positions and spot balances in a single display.
View and monitor perpetual positions.
# One-time fetch
rhl account positions
# Watch mode - real-time updates with colored PnL
rhl account positions -w
# Specific address
rhl account positions --user 0x...Displays: coin, size, entry price, position value, unrealized PnL, leverage, and liquidation price.
View, place, and cancel orders (requires an API wallet account for trading).
rhl account orders
# Watch mode - real-time order updates
rhl account orders -w
# Specific address
rhl account orders --user 0x...Or use:
rhl order lsrhl order limit <side> <size> <coin> <price>
# Examples
rhl order limit buy 0.001 BTC 50000
rhl order limit sell 0.1 ETH 3500 --tif Gtc
rhl order limit long 1 SOL 100 --reduce-only| Option | Description |
|---|---|
--tif <tif> |
Time-in-force: Gtc (default), Ioc, Alo |
--reduce-only |
Reduce-only order |
rhl order market <side> <size> <coin>
# Examples
rhl order market buy 0.001 BTC
rhl order market sell 0.1 ETH --slippage 0.5| Option | Description |
|---|---|
--slippage <pct> |
Slippage percentage (overrides config) |
--reduce-only |
Reduce-only order |
# View current configuration
rhl order configure
# Set default slippage for market orders
rhl order configure --slippage 0.5# Cancel specific order
rhl order cancel <oid>
# Interactive selection from open orders
rhl order cancel# Cancel all open orders
rhl order cancel-all
# Cancel all orders for a specific coin
rhl order cancel-all --coin BTC
# Skip confirmation
rhl order cancel-all -y# Cross margin (default)
rhl order set-leverage <coin> <leverage>
rhl order set-leverage BTC 10
# Isolated margin
rhl order set-leverage BTC 10 --isolated
# Explicit cross margin
rhl order set-leverage ETH 5 --crossView market data without authentication.
# List all perpetual and spot markets
rhl markets ls
# Watch mode
rhl markets ls -wThis command requires the background server (see below).
(Hidden/experimental command.)
rhl markets prices
# Watch mode
rhl markets prices -wView asset-specific data with optional watch mode.
# One-time fetch
rhl asset price BTC
# Watch mode - real-time price updates
rhl asset price BTC -w# One-time fetch with depth visualization
rhl asset book BTC
# Watch mode - real-time order book
rhl asset book ETH -wShows top bid/ask levels with cumulative depth bars and spread calculation.
# One-time fetch
rhl asset leverage BTC
# Watch mode
rhl asset leverage BTC -w
# Specific address
rhl asset leverage BTC --user 0x...(Hidden/experimental commands.)
rhl referral set <code>rhl referral statusOptional background server for caching market data and faster queries (required for rhl markets ls).
rhl server startrhl server stoprhl server statusShows server status, WebSocket connection state, uptime, and cache status.
rhl upgrade
rhl upgrade --jsonChecks the npm registry for the latest hyperliquid-cli version and shows upgrade instructions for this Rust port.
# Check positions on testnet
rhl --testnet account positions
# Place a testnet order
rhl --testnet order limit buy 0.001 BTC 50000# Watch positions with live PnL
rhl account positions -w
# Watch order book with depth visualization
rhl asset book BTC -w
# Watch specific asset price
rhl asset price ETH -w# Get BTC price
BTC_PRICE=$(rhl asset price BTC --json | jq -r '.price')
echo "BTC: $BTC_PRICE"
# Get all positions as JSON
rhl account positions --json | jq '.positions[] | {coin, size, pnl: .unrealizedPnl}'
# Check open orders
rhl account orders --json | jq '.[] | select(.coin == "BTC")'#!/bin/bash
# Simple limit order script
COIN="BTC"
SIDE="buy"
SIZE="0.001"
PRICE="85000"
echo "Placing $SIDE order for $SIZE $COIN @ $PRICE"
rhl order limit $SIDE $SIZE $COIN $PRICE --jsonHYPERLIQUID_PRIVATE_KEY=0x...(optional; used if no default account is set)HYPERLIQUID_WALLET_ADDRESS=0x...(optional; derived from key if omitted)HYPERLIQUID_CLI_DIR=/path/to/dir(optional; overrides~/.hl)
All files live under ~/.hl/:
~/.hl/hl.db(accounts SQLite DB)~/.hl/order-config.json(market-order slippage default)~/.hl/server.sock,~/.hl/server.pid,~/.hl/server.json,~/.hl/server.log(background server)