Configuration

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 | | --json | Output as JSON for scripting (available on info commands: account, positions, funding, fills, orders, markets, funding-scan) | | --leverage | Set leverage before placing an order (available on all trading commands). Uses cross margin for main perps, isolated margin for HIP-3. | | --version, -v | Print 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"

Environment Variables

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

  1. Environment variables
  2. .env file 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: master account (for API wallets)

API Wallet Setup

API wallets (also called agent wallets) are the recommended way to run OpenBroker for automated trading. They can place orders on behalf of your master account but cannot withdraw funds, making them safer for agents and bots.

How it works

  1. Run openbroker setup and choose Generate API wallet. The CLI generates a new keypair and prints an approval URL.
  2. Open the URL in your browser and connect your master wallet (e.g. MetaMask). This is the wallet that holds your funds on Hyperliquid.
  3. Sign two transactions from your master wallet: ApproveAgent (authorizes the API wallet to trade) and ApproveBuilderFee (approves the 1 bps builder fee).
  4. The CLI automatically detects the approval and saves the config. You can now trade using the API wallet.
Example
$ openbroker setup
# Choose option 3: Generate API wallet
 
# CLI prints an approval URL:
#   https://openbroker.dev/approve?agent=0xABC...
#
# Open in browser → connect master wallet → sign approvals
# CLI detects approval and saves config automatically

After setup, the config at ~/.openbroker/.env will contain both the API wallet key and your master account address:

HYPERLIQUID_PRIVATE_KEY=0x...        # API wallet private key
HYPERLIQUID_ACCOUNT_ADDRESS=0x...   # Master account address
HYPERLIQUID_NETWORK=mainnet

Note: Only the master wallet can approve the API wallet and builder fee. These signatures must happen in the browser. You can revoke API wallet access at any time from app.hyperliquid.xyz.

Builder Fee

Open Broker charges 1 bps (0.01%) per trade to fund development. The fee is hardcoded and automatically approved during openbroker setup — for master wallets the approval is signed directly, for API wallets it happens in the browser approval step.

openbroker approve-builder --check       # Check approval status
openbroker approve-builder               # Retry approval if needed
FlagDescriptionDefault
--checkOnly check current approval status, don't approve
--verboseShow debug output