New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

openbroker

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openbroker

Hyperliquid trading CLI - execute orders, manage positions, and run trading strategies

latest
Source
npmnpm
Version
1.0.80
Version published
Maintainers
1
Created
Source

Open Broker

Hyperliquid trading CLI. Execute orders, manage positions, and run trading strategies on Hyperliquid DEX.

Installation

npm install -g openbroker

Quick Start

# 1. Setup (generates wallet, creates config, approves builder fee)
openbroker setup

# 2. Fund your wallet with USDC on Arbitrum, then deposit at https://app.hyperliquid.xyz/

# 3. Start trading
openbroker account                          # View account info
openbroker buy --coin ETH --size 0.1        # Market buy
openbroker search --query GOLD              # Find markets

Commands

Setup

openbroker setup                # One-command setup (wallet + config + builder approval)

The setup command handles everything automatically:

  • Generates a fresh trading wallet (recommended for agents) or accepts your existing private key
  • Saves configuration to ~/.openbroker/.env (permissions 0600)
  • Approves the builder fee (required for trading)

Setup offers three modes:

  • Generate fresh wallet (recommended for agents) — cleanest option, no browser steps
  • Import existing key — use a key you already have
  • Generate API wallet — restricted wallet requiring browser approval from a master wallet

Info Commands

account — View Account Info

Show balance, equity, margin, and positions summary.

openbroker account              # Balance, equity, margin, positions
openbroker account --orders     # Also show open orders
FlagDescriptionDefault
--ordersInclude open orders in the output

positions — View 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
FlagDescriptionDefault
--coinFilter to a single asset

funding — Funding Rates

View funding rates sorted by annualized rate. Highlights high-funding opportunities.

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
FlagDescriptionDefault
--topNumber of results to show20
--coinFilter to a single asset
--sortSort by: annualized, hourly, or oiannualized
--allShow all assets including low OI

markets — Market Data

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
FlagDescriptionDefault
--coinDetailed view for a single asset
--topNumber of results30
--sortSort by: volume, oi, or changevolume

all-markets — 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
FlagDescriptionDefault
--typeFilter: perp, spot, hip3, or allall
--topLimit to top N by volume
--verboseShow detailed output

search — 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
FlagDescriptionDefault
--querySearch term (matches coin name)required
--typeFilter: perp, spot, hip3, or allall
--verboseShow detailed output

spot — Spot Markets & Balances

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
FlagDescriptionDefault
--balancesShow your spot token balances instead of markets
--coinFilter by coin symbol
--topLimit to top N by volume
--verboseShow token metadata

fills — Trade Fill History

View your trade executions with prices, fees, and realized PnL.

openbroker fills                          # Recent fills
openbroker fills --coin ETH               # ETH fills only
openbroker fills --coin BTC --side buy --top 50
FlagDescriptionDefault
--coinFilter by coin symbol
--sideFilter by side: buy or sell
--topNumber of recent fills to show20

orders — Order History

View all historical orders including filled, canceled, and rejected. Use --open to show only currently open orders.

openbroker orders                         # Recent orders
openbroker orders --open                  # Currently open orders only
openbroker orders --open --coin ETH       # Open orders for a specific coin
openbroker orders --coin ETH --status filled
openbroker orders --top 50
FlagDescriptionDefault
--coinFilter by coin symbol
--statusFilter by status (filled, canceled, open, triggered, etc.)
--openShow only currently open orders
--topNumber of recent orders to show20

order-status — Check Order Status

Look up the status of a specific order by ID.

openbroker order-status --oid 123456789   # By order ID
openbroker order-status --oid 0x1234...   # By client order ID
FlagDescriptionDefault
--oidOrder ID (number) or client order ID (hex string)required

fees — Fee Schedule

View your fee tier, maker/taker rates, discounts, and recent daily trading volumes.

openbroker fees

candles — OHLCV Candle Data

View candlestick chart data for an asset.

openbroker candles --coin ETH                           # 24 hourly candles
openbroker candles --coin BTC --interval 4h --bars 48   # 48 four-hour bars
openbroker candles --coin SOL --interval 1d --bars 30   # 30 daily bars
FlagDescriptionDefault
--coinAsset symbolrequired
--intervalCandle interval: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1M1h
--barsNumber of bars to fetch24

funding-history — Historical Funding Rates

View historical funding rate data for an asset.

openbroker funding-history --coin ETH              # Last 24h
openbroker funding-history --coin BTC --hours 168  # Last 7 days
FlagDescriptionDefault
--coinAsset symbolrequired
--hoursHours of history to fetch24

trades — Recent Trades (Tape)

View recent trades for an asset with buy/sell volume breakdown.

openbroker trades --coin ETH              # Last 30 trades
openbroker trades --coin BTC --top 50     # Last 50 trades
FlagDescriptionDefault
--coinAsset symbolrequired
--topNumber of recent trades30

rate-limit — API Rate Limit

Check your API rate limit usage and capacity.

openbroker rate-limit

Trading Commands

buy / sell / market — Market Orders

Execute market orders with slippage protection. buy and sell 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
openbroker buy --coin ETH --size 0.1 --verbose
FlagDescriptionDefault
--coinAsset to trade (ETH, BTC, SOL, HYPE, etc.)required
--sideOrder direction: buy or sell (auto-set by buy/sell command)required
--sizeOrder size in base assetrequired
--slippageSlippage tolerance in bps (basis points)50 (0.5%)
--reduceReduce-only order (won't increase position)false
--dryPreview order details without executing
--verboseShow full API request/response

limit — 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
FlagDescriptionDefault
--coinAsset to traderequired
--sidebuy or sellrequired
--sizeOrder size in base assetrequired
--priceLimit pricerequired
--tifTime in force: GTC (rest on book), IOC (fill or cancel), ALO (post-only, maker only)GTC
--reduceReduce-only orderfalse
--dryPreview without executing

trigger — Trigger Orders (Conditional TP/SL)

Place conditional orders that activate when price reaches a trigger level. Used for stop losses, take profits, and conditional entries.

# Take profit: sell HYPE when price rises to $40
openbroker trigger --coin HYPE --side sell --size 0.5 --trigger 40 --type tp

# Stop loss: sell HYPE when price drops to $30
openbroker trigger --coin HYPE --side sell --size 0.5 --trigger 30 --type sl

# Buy stop: buy BTC on breakout above $75k
openbroker trigger --coin BTC --side buy --size 0.01 --trigger 75000 --type sl --reduce false
FlagDescriptionDefault
--coinAsset to traderequired
--sideOrder side when triggered: buy or sellrequired
--sizeOrder size in base assetrequired
--triggerTrigger price (order activates at this level)required
--typeOrder type: tp (take profit) or sl (stop loss)required
--limitCustom limit price when triggered (overrides auto-calculation)auto
--slippageSlippage for stop loss limit price in bps100 (1%)
--reduceReduce-only ordertrue
--dryPreview without placing
--verboseShow debug output

Trigger behavior:

  • TP: Limit price = trigger price (favorable fill)
  • SL: Limit price = trigger ± slippage (ensures fill in fast markets)

tpsl — Set TP/SL on Existing Position

Attach take-profit and/or stop-loss trigger orders to an open position. Supports absolute prices, percentage offsets, 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      # Breakeven stop
openbroker tpsl --coin ETH --sl -5%                   # Stop loss only
openbroker tpsl --coin ETH --tp 4000 --sl 3500 --size 0.5  # Partial position
FlagDescriptionDefault
--coinAsset with an open positionrequired
--tpTake profit price: absolute (40), percentage (+10%), or entry
--slStop loss price: absolute (30), percentage (-5%), or entry
--sizeSize to protect (for partial TP/SL)full position
--sl-slippageStop loss slippage buffer in bps100 (1%)
--dryPreview orders without placing
--verboseShow debug output

Shows risk/reward ratio and potential profit/loss before placing.

cancel — 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
FlagDescriptionDefault
--coinCancel orders for a specific coin only
--oidCancel a specific order by ID
--allCancel all open orders
--dryShow orders without cancelling

Advanced Execution

twap — Native TWAP Order

Place a native Hyperliquid TWAP order. The exchange handles order slicing and execution timing server-side — returns immediately with a TWAP ID.

# Buy 1 ETH over 30 minutes
openbroker twap --coin ETH --side buy --size 1 --duration 30

# Sell 0.5 BTC over 2 hours without randomized timing
openbroker twap --coin BTC --side sell --size 0.5 --duration 120 --randomize false

# Preview order details
openbroker twap --coin ETH --side buy --size 2 --duration 60 --dry
FlagDescriptionDefault
--coinAsset to traderequired
--sidebuy or sellrequired
--sizeTotal order size in base assetrequired
--durationDuration in minutes (5–1440)required
--randomizeRandomize execution timingtrue
--reduce-onlyReduce-only orderfalse
--leverageSet leverage before placing
--dryShow order details without placing
--verboseShow debug output

twap-cancel — Cancel TWAP Order

Cancel a running native TWAP order by its TWAP ID.

openbroker twap-cancel --coin ETH --twap-id 77738308
FlagDescriptionDefault
--coinAsset symbolrequired
--twap-idTWAP order ID to cancelrequired

twap-status — TWAP Order Status

View TWAP order history and currently running TWAP orders.

openbroker twap-status              # All TWAP history
openbroker twap-status --active     # Only running TWAPs
FlagDescriptionDefault
--activeShow only active/running TWAP orders

scale — Scale In/Out

Place a grid of limit orders to scale into or out of a position. Three distribution modes control how size is allocated across price levels.

openbroker scale --coin ETH --side buy --size 1 --levels 5 --range 2
openbroker scale --coin ETH --side buy --size 2 --levels 8 --range 5 --distribution exponential
openbroker scale --coin BTC --side sell --size 0.5 --levels 4 --range 3 --reduce
FlagDescriptionDefault
--coinAsset to traderequired
--sidebuy or sellrequired
--sizeTotal order size in base assetrequired
--levelsNumber of price levels (orders)required
--rangePrice range from current mid in %required
--distributionSize distribution: linear (more at better prices), exponential (much more), flat (equal)linear
--tifTime in force: GTC or ALOGTC
--reduceReduce-only orders (for scaling out)false
--dryShow order grid without placing
--verboseShow debug output

bracket — Bracket Order (Entry + TP + SL)

Complete trade setup in one command. Supports market or limit entry with automatic take-profit and stop-loss trigger orders.

openbroker bracket --coin ETH --side buy --size 0.5 --tp 3 --sl 1.5
openbroker bracket --coin BTC --side sell --size 0.1 --entry limit --price 100000 --tp 5 --sl 2
FlagDescriptionDefault
--coinAsset to traderequired
--sideEntry direction: buy (long) or sell (short)required
--sizePosition size in base assetrequired
--tpTake profit distance in % from entryrequired
--slStop loss distance in % from entryrequired
--entryEntry type: market or limitmarket
--priceEntry price (required if --entry limit)
--slippageSlippage for market entry in bps50
--dryShow bracket plan without executing
--verboseShow debug output

Executes in 3 steps: Entry → TP trigger → SL trigger. Shows risk/reward ratio and potential profit/loss.

chase — Chase Order

Follow the price with ALO (post-only) limit orders to get maker fills and avoid taker fees.

openbroker chase --coin ETH --side buy --size 0.5
openbroker chase --coin SOL --side buy --size 10 --offset 1 --timeout 60 --max-chase 50
openbroker chase --coin BTC --side sell --size 0.1 --offset 2 --timeout 600
FlagDescriptionDefault
--coinAsset to traderequired
--sidebuy or sellrequired
--sizeOrder size in base assetrequired
--offsetOffset from mid price in bps5 (0.05%)
--timeoutMax time to chase in seconds300 (5 min)
--intervalPrice check / order update interval in ms2000
--max-chaseMax price to chase to in bps from start100 (1%)
--reduceReduce-only order
--dryShow chase parameters without executing
--verboseShow debug output

Uses ALO orders exclusively, guaranteeing maker rebates. Stops when filled, timed out, or max chase reached.

Strategies

funding-arb — Funding Arbitrage

Collect funding payments by taking positions opposite to the majority. Monitors funding continuously and auto-closes when rates drop.

openbroker funding-arb --coin ETH --size 5000 --min-funding 25
openbroker funding-arb --coin BTC --size 10000 --duration 24 --check 30
openbroker funding-arb --coin ETH --size 5000 --dry
FlagDescriptionDefault
--coinAsset to traderequired
--sizePosition size in USD notionalrequired
--min-fundingMinimum annualized funding rate to enter (%)20
--max-fundingMaximum rate — avoid extreme/squeeze risk (%)200
--durationHow long to run in hours
--checkFunding check interval in minutes60
--close-atClose position when funding drops below X%5
--modeperp (directional) or hedge (delta neutral — not yet implemented)perp
--dryShow opportunity analysis without trading
--verboseShow debug output

Note: Hyperliquid funding is paid hourly (not 8h like CEXs). Annualized = hourly × 8,760.

grid — Grid Trading

Automatically buy low and sell high within a price range. Replaces filled orders on the opposite side.

openbroker grid --coin ETH --lower 3000 --upper 4000 --grids 10 --size 0.1
openbroker grid --coin BTC --lower 90000 --upper 100000 --grids 5 --size 0.01 --mode long
FlagDescriptionDefault
--coinAsset to traderequired
--lowerLower bound of grid (price)required
--upperUpper bound of grid (price)required
--gridsNumber of grid levels10
--sizeSize per grid level in base asset
--total-sizeOR total size to distribute across grids
--modeneutral (buy+sell), long (buys only), short (sells only)neutral
--refreshRebalance check interval in seconds60
--durationHow long to run in hours
--dryShow grid plan without placing orders
--verboseShow debug output

Handles graceful shutdown (Ctrl+C) — cancels all grid orders and prints PnL summary.

dca — Dollar Cost Averaging

Accumulate a position over time with regular purchases at fixed USD amounts.

openbroker dca --coin ETH --amount 100 --interval 1h --count 24
openbroker dca --coin BTC --total 5000 --interval 1d --count 30
FlagDescriptionDefault
--coinAsset to accumulaterequired
--amountUSD amount per purchase
--totalOR total USD to invest (calculates per-purchase)
--intervalTime between purchases: Xm, Xh, Xd, Xwrequired
--countNumber of purchases to makerequired
--slippageSlippage tolerance in bps50
--dryShow DCA plan and schedule without executing
--verboseShow debug output

Reports running average price, total acquired, and unrealized PnL after completion.

mm-maker — Market Making (ALO / Maker-Only)

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). Reads the actual order book for pricing.

openbroker mm-maker --coin HYPE --size 1 --offset 1
openbroker mm-maker --coin ETH --size 0.1 --offset 2 --max-position 0.5
FlagDescriptionDefault
--coinAsset to market makerequired
--sizeOrder size on each side (base asset)required
--offsetOffset from best bid/ask in bps1
--max-positionMax net position before stopping that side3× size
--skew-factorHow aggressively to skew for inventory2.0
--refreshRefresh interval in milliseconds2000
--durationHow long to run in minutes
--dryShow setup without trading
--verboseShow debug output

Fee structure: Taker ~2.5 bps (you pay), Maker ~0.3 bps (you earn). ALO-only = always earn.

mm-spread — Market Making (Spread-Based)

Place bid/ask quotes around the mid price, earning the spread when both sides fill. Includes inventory skewing and cooldown after fills.

openbroker mm-spread --coin ETH --size 0.1 --spread 10
openbroker mm-spread --coin BTC --size 0.01 --spread 5 --max-position 0.03 --cooldown 3000
FlagDescriptionDefault
--coinAsset to market makerequired
--sizeOrder size on each side (base asset)required
--spreadTotal spread width in bps from midrequired
--skew-factorHow aggressively to skew for inventory2.0
--max-positionMaximum net position3× size
--cooldownCooldown after fill before same-side requote (ms)5000
--refreshRefresh interval in milliseconds2000
--durationHow long to run in minutes
--dryShow strategy parameters without trading
--verboseShow debug output

Inventory management: When LONG → bid wider, ask tighter. When SHORT → bid tighter, ask wider. At max position → stops quoting that side.

Global Options

FlagDescription
--help, -hShow help for a command
--dryPreview without executing (all trading/strategy commands)
--verboseShow debug output including API requests/responses
--version, -vPrint the CLI version

Safety

Always use --dry first to preview any operation:

openbroker buy --coin ETH --size 0.1 --dry

Use testnet for testing:

export HYPERLIQUID_NETWORK="testnet"

Configuration

Config is loaded from these locations (in order of priority):

  • Environment variables
  • .env file in current directory
  • ~/.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 wallets

The simplest setup for agents — generates a dedicated wallet, auto-approves the builder fee, and is ready to trade after funding:

openbroker setup    # Choose option 1, fund with USDC, start trading

API Wallet Setup (Alternative)

For delegated trading without moving funds, use an API wallet:

export HYPERLIQUID_PRIVATE_KEY="0x..."        # API wallet private key
export HYPERLIQUID_ACCOUNT_ADDRESS="0x..."    # Main account address

Note: API wallets require browser approval from the master wallet. The master wallet signs ApproveAgent and ApproveBuilderFee transactions via the approval URL provided during setup.

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
FlagDescriptionDefault
--checkOnly check current approval status, don't approve
--max-feeMaximum fee rate to approve0.1%
--builderCustom builder address (advanced)Open Broker
--verboseShow debug output

OpenClaw Plugin

OpenBroker ships as an OpenClaw plugin. When installed via OpenClaw, it registers structured agent tools and a background position watcher — no Bash wrappers needed.

Install via OpenClaw

openclaw plugins install openbroker

Or install from a local checkout during development:

openclaw plugins install -l ./open-broker-mvp

After installation, run openbroker setup to configure your wallet (same onboarding as the standalone CLI).

Plugin Tools

When loaded, the plugin registers these agent tools:

CategoryToolDescription
Infoob_accountAccount balance, equity, margin, open orders
Infoob_positionsOpen positions with PnL, leverage, liquidation price
Infoob_fillsTrade fill history with fees and realized PnL
Infoob_ordersOrder history (filled, canceled, open, etc.)
Infoob_order_statusCheck status of a specific order by ID
Infoob_feesFee schedule, tier, maker/taker rates, volume
Infoob_fundingFunding rates sorted by annualized rate
Infoob_funding_historyHistorical funding rates for an asset
Infoob_candlesOHLCV candle data for an asset
Infoob_tradesRecent trades (tape) for an asset
Infoob_marketsMarket data (price, volume, OI)
Infoob_searchSearch assets across perps, HIP-3, and spot
Infoob_spotSpot markets and token balances
Infoob_rate_limitAPI rate limit usage and capacity
Tradingob_buyMarket buy
Tradingob_sellMarket sell
Tradingob_limitLimit order (GTC, IOC, ALO)
Tradingob_triggerTrigger order (TP/SL)
Tradingob_tpslSet TP/SL on existing position
Tradingob_cancelCancel orders
Advancedob_twapNative TWAP order (exchange-managed)
Advancedob_twap_cancelCancel a running TWAP order
Advancedob_twap_statusView TWAP order history/status
Advancedob_bracketEntry + TP + SL
Advancedob_chaseChase price with ALO orders
Monitoringob_watcher_statusBackground watcher state

Background Position Watcher

The plugin runs a background service that polls your Hyperliquid account every 30 seconds and sends webhook notifications when:

  • Position opened — new position detected
  • Position closed — position removed
  • Size changed — position increased or decreased
  • PnL threshold — unrealized PnL changed by more than the configured % (default: 5%)
  • Margin warning — margin usage exceeds threshold (default: 80%)

Plugin Configuration

Configure in your OpenClaw settings under plugins.entries.openbroker.config:

{
  "privateKey": "0x...",
  "accountAddress": "0x...",
  "network": "mainnet",
  "hooksToken": "your-hooks-secret",
  "watcher": {
    "enabled": true,
    "pollIntervalMs": 30000,
    "pnlChangeThresholdPct": 5,
    "marginUsageWarningPct": 80,
    "notifyOnPositionChange": true,
    "notifyOnFunding": true
  }
}

All fields are optional — the plugin falls back to ~/.openbroker/.env and environment variables.

OpenClaw Webhook Setup

For the position watcher to notify your agent, you need webhooks enabled in your OpenClaw gateway config:

hooks:
  enabled: true
  token: "your-hooks-secret"   # Must match hooksToken in plugin config

The watcher sends alerts to POST /hooks/agent with wakeMode: "now", which triggers an immediate agent turn. The agent receives a message like:

Position alert: ETH unrealized PnL changed from +$500 to -$200 (-140%).

CLI Commands

The plugin also registers CLI commands accessible via the OpenClaw CLI:

openclaw ob status    # Show watcher state and current positions
openclaw ob watch     # Run watcher in foreground (debugging)

Development

For local development without global install:

git clone https://github.com/monemetrics/openbroker.git
cd openbroker
npm install
npx tsx scripts/info/account.ts

License

MIT

Keywords

hyperliquid

FAQs

Package last updated on 02 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts