Configuration
Authentication
hlz needs a private key for trading operations. Market data commands work without auth.
Encrypted Keystore (Recommended)
# Generate a new key
hlz keys new trading
# Import an existing key
hlz keys import trading --private-key 0xYOUR_KEY
# Set as default
hlz keys default trading
# List all keys
hlz keys lsKeys are stored encrypted at ~/.hlz/keys/. Use --key-name to select a specific key per command.
Environment Variables
| Variable | Description |
|---|---|
HL_KEY | Private key (raw hex, no 0x prefix) |
HL_PASSWORD | Keystore password (for --key-name) |
HL_ADDRESS | Default wallet address (for read-only queries) |
HL_CHAIN | Default chain: mainnet (default) or testnet |
HL_OUTPUT | Default output format: json, pretty, or csv |
NO_COLOR | Disable colored output |
Config Files
hlz loads config from key=value files (same format as .env):
Project-level — .env in the current directory:
HL_KEY=your_private_key_hex
HL_ADDRESS=0xYourAddress
HL_CHAIN=mainnetSystem-level — ~/.hl/config (used as fallback if no .env found):
HL_KEY=your_private_key_hex
HL_ADDRESS=0xYourAddress
HL_CHAIN=mainnetSupported keys: HL_KEY, TRADING_KEY, HL_ADDRESS, ADDRESS, HL_CHAIN, CHAIN.
Priority Order
- Command-line flags (
--key,--key-name,--chain) - Environment variables (
HL_KEY,HL_CHAIN) .envfile in current directory~/.hl/configfile- Defaults (mainnet, no key)
Testnet
Add --chain testnet to any command:
hlz buy BTC 0.1 @50000 --chain testnetOr set globally:
export HL_CHAIN=testnetOutput Formats
| Flag | When | Format |
|---|---|---|
| (none, TTY) | Interactive terminal | Colored tables |
| (none, piped) | hlz price BTC | jq | JSON (auto-detected) |
--json | Explicit | JSON |
--output pretty | Explicit | Formatted tables |
--output csv | Explicit | CSV |
--quiet / -q | Minimal | Just the value |