Open Broker
v1.0.39Hyperliquid trading CLI. Execute orders, manage positions, and run trading strategies on Hyperliquid DEX.
Installation
npm install -g openbrokerQuick Start
Setup
Generates wallet, creates config, and approves builder fee — all in one command.
openbroker setupFund your wallet
Send USDC on Arbitrum to your wallet, then deposit at app.hyperliquid.xyz
Start trading
openbroker account # View account info
openbroker buy --coin ETH --size 0.1 # Market buy
openbroker search --query GOLD # Find marketsCommands
Setup
Interactive one-command setup that handles wallet creation, config, and builder fee approval.
openbroker setupThe setup wizard:
- •Generates a new wallet or accepts your existing private key
- •Saves configuration to
~/.openbroker/.env(permissions0600) - •Automatically approves the builder fee for trading
Account Info
View your balance, equity, margin, positions, and open orders.
openbroker account # Balance, equity, margin, positions
openbroker account --orders # Also show open orders| Flag | Description | Default |
|---|---|---|
| --orders | Include open orders in the output | — |
Positions
Detailed position view with entry/mark prices, PnL, leverage, liquidation distance, and margin used.
openbroker positions # All open positions
openbroker positions --coin ETH # Single position detail| Flag | Description | Default |
|---|---|---|
| --coin | Filter to a single asset | — |
Funding Rates
openbroker funding # Top 20 by annualized rate
openbroker funding --top 50 # Top 50
openbroker funding --coin ETH # Single asset
openbroker funding --sort oi # Sort by open interest| Flag | Description | Default |
|---|---|---|
| --top | Number of results to show | 20 |
| --coin | Filter to a single asset | — |
| --sort | Sort by: annualized, hourly, or oi | annualized |
| --all | Show all assets including low OI | — |
Markets
Market data for perpetuals. Pass --coin for a detailed single-asset view with oracle price, min size, and more.
openbroker markets # Top 30 perps by volume
openbroker markets --coin ETH # Detailed view for ETH
openbroker markets --sort change --top 10 # Top movers| Flag | Description | Default |
|---|---|---|
| --coin | Detailed view for a single asset | — |
| --top | Number of results | 30 |
| --sort | Sort by: volume, oi, or change | volume |
All Markets
Browse all available markets across main perps, HIP-3 perps, and spot — grouped by type.
openbroker all-markets # Everything
openbroker all-markets --type perp # Main perps only
openbroker all-markets --type hip3 # HIP-3 perps only
openbroker all-markets --type spot # Spot only
openbroker all-markets --top 20 # Top 20 by volume| Flag | Description | Default |
|---|---|---|
| --type | Filter: perp, spot, hip3, or all | all |
| --top | Limit to top N by volume | — |
| --verbose | Show detailed output | — |
Search Markets
Search for assets by name across all providers (perps, HIP-3, spot). Shows funding comparison when an asset is listed on multiple venues.
openbroker search --query GOLD # Find all GOLD markets
openbroker search --query ETH --type perp # ETH perps only
openbroker search --query PURR --type spot # PURR spot only| Flag | Description | Default |
|---|---|---|
| --query | Search term (matches coin name) | required |
| --type | Filter: perp, spot, hip3, or all | all |
| --verbose | Show detailed output | — |
Spot
openbroker spot # All spot markets
openbroker spot --balances # Your spot token balances
openbroker spot --coin PURR # Filter by coin
openbroker spot --top 20 # Top 20 by volume| Flag | Description | Default |
|---|---|---|
| --balances | Show your spot token balances instead of markets | — |
| --coin | Filter by coin symbol | — |
| --top | Limit to top N by volume | — |
| --verbose | Show token metadata | — |
Market Orders
Execute market buy/sell with slippage protection. The buy and sell commands are shortcuts that set --side automatically.
openbroker buy --coin ETH --size 0.1
openbroker sell --coin BTC --size 0.01
openbroker buy --coin SOL --size 10 --slippage 100 --dry| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade (ETH, BTC, SOL, HYPE, etc.) | required |
| --side | Order direction: buy or sell (auto-set by buy/sell command) | required |
| --size | Order size in base asset | required |
| --slippage | Slippage tolerance in bps (basis points) | 50 (0.5%) |
| --reduce | Reduce-only order (won't increase position) | false |
| --dry | Preview order details without executing | — |
| --verbose | Show full API request/response | — |
Limit Orders
Place a limit order at a specific price. Supports three time-in-force modes.
openbroker limit --coin ETH --side buy --size 1 --price 3000
openbroker limit --coin BTC --side sell --size 0.1 --price 100000 --tif ALO
openbroker limit --coin SOL --side buy --size 10 --price 150 --reduce| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --side | Order direction: buy or sell | required |
| --size | Order size in base asset | required |
| --price | Limit price | required |
| --tif | Time in force: GTC (rests on book), IOC (fill or cancel), ALO (post-only, maker only) | GTC |
| --reduce | Reduce-only order | false |
| --dry | Preview without executing | — |
Trigger Orders
Place conditional orders that activate when price reaches a trigger level. Used for stop losses, take profits, and conditional entries.
openbroker trigger --coin HYPE --side sell --size 0.5 --trigger 40 --type tpopenbroker trigger --coin HYPE --side sell --size 0.5 --trigger 30 --type slopenbroker trigger --coin BTC --side buy --size 0.01 --trigger 75000 --type sl --reduce false| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --side | Order side when triggered: buy or sell | required |
| --size | Order size in base asset | required |
| --trigger | Trigger price (order activates at this level) | required |
| --type | Order type: tp (take profit) or sl (stop loss) | required |
| --limit | Custom limit price when triggered (overrides default) | auto |
| --slippage | Slippage for stop loss limit price in bps | 100 (1%) |
| --reduce | Reduce-only order | true |
| --dry | Preview without placing | — |
| --verbose | Show debug output | — |
TP/SL on Existing Position
Attach take-profit and/or stop-loss trigger orders to an open position. Supports absolute prices, percentage offsets from entry, and breakeven stops.
openbroker tpsl --coin HYPE --tp 40 --sl 30 # Absolute prices
openbroker tpsl --coin ETH --tp +10% --sl -5% # Percentage from entry
openbroker tpsl --coin HYPE --tp +10% --sl entry # TP at +10%, SL at entry (breakeven)
openbroker tpsl --coin ETH --sl -5% # Stop loss only
openbroker tpsl --coin ETH --tp 4000 --sl 3500 --size 0.5 # Partial position| Flag | Description | Default |
|---|---|---|
| --coin | Asset with an open position | required |
| --tp | Take profit price: absolute ($40), percentage (+10%), or "entry" | — |
| --sl | Stop loss price: absolute ($30), percentage (-5%), or "entry" | — |
| --size | Size to protect (partial TP/SL) | full position |
| --sl-slippage | Stop loss slippage buffer in bps | 100 (1%) |
| --dry | Preview orders without placing | — |
| --verbose | Show debug output | — |
Shows risk/reward ratio, potential profit/loss, and current unrealized PnL before placing orders.
Cancel Orders
openbroker cancel --all # Cancel all open orders
openbroker cancel --coin ETH # Cancel all ETH orders
openbroker cancel --coin ETH --oid 123456 # Cancel specific order
openbroker cancel --all --dry # Preview what would be cancelled| Flag | Description | Default |
|---|---|---|
| --coin | Cancel orders for a specific coin only | — |
| --oid | Cancel a specific order by ID | — |
| --all | Cancel all open orders | — |
| --dry | Show orders without cancelling | — |
Advanced Execution
TWAP
Time-Weighted Average Price execution. Splits a large order into smaller slices executed at regular intervals to minimize market impact.
# Buy 1 ETH over 1 hour (auto-calculates ~12 slices, every 5 min)
openbroker twap --coin ETH --side buy --size 1 --duration 3600
# Sell 0.5 BTC over 30 min with 6 slices and timing randomization
openbroker twap --coin BTC --side sell --size 0.5 --duration 1800 --intervals 6 --randomize 20
# Preview execution plan
openbroker twap --coin ETH --side buy --size 2 --duration 7200 --dry| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --side | buy or sell | required |
| --size | Total order size in base asset | required |
| --duration | Total execution time in seconds | required |
| --intervals | Number of slices | 1 per 5 min |
| --randomize | Randomize timing by ±X percent | 0 |
| --slippage | Slippage tolerance per slice in bps | 50 |
| --dry | Show execution plan without trading | — |
| --verbose | Show debug output | — |
Reports VWAP, actual slippage vs start price, fill rate per slice, and total execution time.
Scale
Place a grid of limit orders to scale into or out of a position. Supports three size distribution modes for different strategies.
# Scale into 1 ETH with 5 buy orders spread 2% below mid
openbroker scale --coin ETH --side buy --size 1 --levels 5 --range 2
# Scale out with exponential distribution (more size at better prices)
openbroker scale --coin ETH --side buy --size 2 --levels 8 --range 5 --distribution exponential
# Scale out of BTC position (reduce-only)
openbroker scale --coin BTC --side sell --size 0.5 --levels 4 --range 3 --reduce| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --side | buy or sell | required |
| --size | Total order size in base asset | required |
| --levels | Number of price levels (orders) | required |
| --range | Price range from current mid in % | required |
| --distribution | Size distribution: linear (more at better prices), exponential (much more at better prices), or flat (equal) | linear |
| --tif | Time in force: GTC or ALO | GTC |
| --reduce | Reduce-only orders (for scaling out) | false |
| --dry | Show order grid without placing | — |
| --verbose | Show debug output | — |
Bracket
Complete trade setup in one command: entry order with automatic take-profit and stop-loss. Supports market or limit entry.
# Long ETH with 3% TP and 1.5% SL (market entry)
openbroker bracket --coin ETH --side buy --size 0.5 --tp 3 --sl 1.5
# Short BTC with limit entry at $100k, 5% TP, 2% SL
openbroker bracket --coin BTC --side sell --size 0.1 --entry limit --price 100000 --tp 5 --sl 2
# Preview bracket setup
openbroker bracket --coin SOL --side buy --size 10 --tp 5 --sl 2 --dry| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --side | Entry direction: buy (long) or sell (short) | required |
| --size | Position size in base asset | required |
| --tp | Take profit distance in % from entry | required |
| --sl | Stop loss distance in % from entry | required |
| --entry | Entry type: market or limit | market |
| --price | Entry price (required if --entry limit) | — |
| --slippage | Slippage for market entry in bps | 50 |
| --dry | Show bracket plan without executing | — |
| --verbose | Show debug output | — |
Shows risk/reward ratio, potential profit/loss, and executes in 3 steps: entry → TP trigger → SL trigger. TP and SL are placed as trigger orders that only execute when price reaches the target.
Chase
Follow the price with ALO (post-only) limit orders to get maker fills and avoid taker fees. Continuously adjusts the order to stay near the best price.
# Chase buy 0.5 ETH (default: 5 bps offset, 5 min timeout)
openbroker chase --coin ETH --side buy --size 0.5
# Aggressive chase: tighter offset, short timeout, strict max chase
openbroker chase --coin SOL --side buy --size 10 --offset 1 --timeout 60 --max-chase 50
# Wider offset, longer timeout
openbroker chase --coin BTC --side sell --size 0.1 --offset 2 --timeout 600| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --side | buy or sell | required |
| --size | Order size in base asset | required |
| --offset | Offset from mid price in bps | 5 (0.05%) |
| --timeout | Max time to chase in seconds | 300 (5 min) |
| --interval | Price check / order update interval in ms | 2000 |
| --max-chase | Max price to chase to in bps from start price | 100 (1%) |
| --reduce | Reduce-only order | — |
| --dry | Show chase parameters without executing | — |
| --verbose | Show debug output | — |
Uses ALO orders exclusively, guaranteeing maker rebates. Cancels and replaces the order each time price moves, and stops when filled, timed out, or max chase distance is reached.
Strategies
Funding Arbitrage
Collect funding payments by taking positions opposite to the majority. When funding is positive (longs pay shorts), go short to collect — and vice versa. Monitors funding continuously and can auto-close when rates drop.
# Enter $5000 short if ETH funding > 25% annualized
openbroker funding-arb --coin ETH --size 5000 --min-funding 25
# Run for 24 hours, check every 30 minutes
openbroker funding-arb --coin BTC --size 10000 --duration 24 --check 30
# Preview current opportunity
openbroker funding-arb --coin ETH --size 5000 --dry| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --size | Position size in USD notional | required |
| --min-funding | Minimum annualized funding rate to enter (%) | 20 |
| --max-funding | Maximum rate — avoid extreme/squeeze risk (%) | 200 |
| --duration | How long to run in hours | ∞ |
| --check | Funding check interval in minutes | 60 |
| --close-at | Close position when funding drops below X% | 5 |
| --mode | perp (directional) or hedge (delta neutral — not yet implemented) | perp |
| --dry | Show opportunity analysis without trading | — |
| --verbose | Show debug output | — |
Note: Hyperliquid funding is paid hourly (not 8h like CEXs). Annualized = hourly rate × 8,760.
Grid Trading
Automatically buy low and sell high within a defined price range. Places a grid of limit orders and replaces filled orders on the opposite side for continuous range trading.
# ETH grid $3000-$4000, 10 levels, 0.1 per level
openbroker grid --coin ETH --lower 3000 --upper 4000 --grids 10 --size 0.1
# BTC accumulation grid (buys only)
openbroker grid --coin BTC --lower 90000 --upper 100000 --grids 5 --size 0.01 --mode long
# Preview grid
openbroker grid --coin ETH --lower 3000 --upper 4000 --grids 10 --size 0.1 --dry| Flag | Description | Default |
|---|---|---|
| --coin | Asset to trade | required |
| --lower | Lower bound of grid (price) | required |
| --upper | Upper bound of grid (price) | required |
| --grids | Number of grid levels | 10 |
| --size | Size per grid level in base asset | — |
| --total-size | OR total size to distribute across grids | — |
| --mode | neutral (buy+sell), long (buys only), short (sells only) | neutral |
| --refresh | Rebalance interval in seconds | 60 |
| --duration | How long to run in hours | ∞ |
| --dry | Show grid plan without placing orders | — |
| --verbose | Show debug output | — |
DCA (Dollar Cost Averaging)
Accumulate a position over time with regular purchases at fixed USD amounts. Supports flexible interval formats.
# Buy $100 of ETH every hour for 24 purchases
openbroker dca --coin ETH --amount 100 --interval 1h --count 24
# Invest $5000 in BTC over 30 daily purchases
openbroker dca --coin BTC --total 5000 --interval 1d --count 30
# Preview DCA plan
openbroker dca --coin SOL --amount 50 --interval 4h --count 42 --dry| Flag | Description | Default |
|---|---|---|
| --coin | Asset to accumulate | required |
| --amount | USD amount per purchase | — |
| --total | OR total USD to invest (calculates per-purchase amount) | — |
| --interval | Time between purchases: Xm, Xh, Xd, Xw (e.g., 1h, 4h, 1d, 1w) | required |
| --count | Number of purchases to make | required |
| --slippage | Slippage tolerance in bps | 50 |
| --dry | Show DCA plan and schedule without executing | — |
| --verbose | Show debug output | — |
Market Making — Maker-Only (ALO)
Provide liquidity using ALO (Add Liquidity Only) orders that are rejected if they would cross the spread. Guarantees you always earn the maker rebate (~0.3 bps) instead of paying taker fees. Reads the actual order book for pricing.
# Market make HYPE with 1 bps offset from best bid/ask
openbroker mm-maker --coin HYPE --size 1 --offset 1
# Wider offset for volatile assets
openbroker mm-maker --coin ETH --size 0.1 --offset 2 --max-position 0.5| Flag | Description | Default |
|---|---|---|
| --coin | Asset to market make | required |
| --size | Order size on each side (base asset) | required |
| --offset | Offset from best bid/ask in bps | 1 |
| --max-position | Maximum net position before stopping that side | 3× size |
| --skew-factor | How aggressively to skew quotes for inventory | 2.0 |
| --refresh | Refresh interval in milliseconds | 2000 |
| --duration | How long to run in minutes | ∞ |
| --dry | Show setup without trading | — |
| --verbose | Show debug output | — |
Market Making — Spread-Based
Place bid/ask quotes around the mid price. Earns the spread when both sides fill. Includes inventory skewing and cooldown after fills to manage directional risk.
# Market make ETH with 10bps spread
openbroker mm-spread --coin ETH --size 0.1 --spread 10
# Tighter position limit, faster cooldown
openbroker mm-spread --coin BTC --size 0.01 --spread 5 --max-position 0.03 --cooldown 3000| Flag | Description | Default |
|---|---|---|
| --coin | Asset to market make | required |
| --size | Order size on each side (base asset) | required |
| --spread | Total spread width in bps from mid | required |
| --skew-factor | How aggressively to skew for inventory | 2.0 |
| --max-position | Maximum net position | 3× size |
| --cooldown | Cooldown after fill before same-side requote (ms) | 5000 |
| --refresh | Refresh interval in milliseconds | 2000 |
| --duration | How long to run in minutes | ∞ |
| --dry | Show strategy parameters without trading | — |
| --verbose | Show debug output | — |
Global Options
These flags are available across all commands.
| Flag | Description |
|---|---|
| --help, -h | Show help for a command |
| --dry | Preview the operation without executing (available on all trading/strategy commands) |
| --verbose | Show detailed debug output including API requests/responses |
| --version, -v | Print the CLI version |
Safety
Always use --dry first to preview any operation:
openbroker buy --coin ETH --size 0.1 --dryUse testnet for testing:
export HYPERLIQUID_NETWORK="testnet"Configuration
Config is loaded from these locations (in order of priority):
- 1Environment variables
- 2
.envfile in current directory - 3
~/.openbroker/.env(global config)
Run openbroker setup to create the global config, or set environment variables:
export HYPERLIQUID_PRIVATE_KEY=0x... # Required: wallet private key
export HYPERLIQUID_NETWORK=mainnet # Optional: mainnet (default) or testnet
export HYPERLIQUID_ACCOUNT_ADDRESS=0x... # Optional: for API walletsAPI Wallet Setup
For automated trading, use an API wallet:
export HYPERLIQUID_PRIVATE_KEY="0x..." # API wallet private key
export HYPERLIQUID_ACCOUNT_ADDRESS="0x..." # Main account addressNote: Builder fee must be approved with the main wallet first. Sub-accounts cannot approve builder fees. After approval, you can switch to using the API wallet for trading.
Builder Fee
Open Broker charges 1 bps (0.01%) per trade to fund development. The builder fee is automatically approved during openbroker setup.
openbroker approve-builder --check # Check approval status
openbroker approve-builder # Retry approval if needed
openbroker approve-builder --max-fee "0.05%" # Custom max fee| Flag | Description | Default |
|---|---|---|
| --check | Only check current approval status, don't approve | — |
| --max-fee | Maximum fee rate to approve | 0.1% |
| --builder | Custom builder address (advanced) | Open Broker |
| --verbose | Show debug output | — |
CLI Reference
Complete command reference for openbroker.
| Category | Command | Description |
|---|---|---|
| Setup | setup, onboard | Interactive setup wizard (wallet + config + builder) |
| Setup | approve-builder | Approve builder fee (one-time) |
| Info | account | Balance, equity, margin, positions |
| Info | positions | Detailed positions with PnL and liquidation |
| Info | funding | Funding rates sorted by annualized rate |
| Info | markets | Perp market data, prices, volume, OI |
| Info | all-markets | All markets (perps, HIP-3, spot) |
| Info | search | Search assets across all providers |
| Info | spot | Spot markets and token balances |
| Trading | buy | Market buy (shortcut for market --side buy) |
| Trading | sell | Market sell (shortcut for market --side sell) |
| Trading | market | Market order with --side flag |
| Trading | limit | Limit order (GTC, IOC, or ALO) |
| Trading | trigger | Trigger order (TP/SL conditional) |
| Trading | tpsl | Set TP/SL on existing position |
| Trading | cancel | Cancel orders (by coin, ID, or all) |
| Advanced | twap | Time-weighted average price execution |
| Advanced | scale | Grid of limit orders (linear/exp/flat) |
| Advanced | bracket | Entry + TP + SL in one command |
| Advanced | chase | Chase price with ALO orders |
| Strategy | funding-arb | Funding rate arbitrage with auto-close |
| Strategy | grid | Grid trading (neutral/long/short) |
| Strategy | dca | Dollar cost averaging (Xm/Xh/Xd/Xw) |
| Strategy | mm-spread | Market making (spread-based, GTC) |
| Strategy | mm-maker | Market making (ALO, maker-only) |