Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Getting Started

hlz gives you three things:

  1. hlz — A 38-command CLI for Hyperliquid (827KB)
  2. hlz-terminal — A full trading terminal (768KB)
  3. hlz — A Zig library for building your own tools

Install the CLI

curl -fsSL https://raw.githubusercontent.com/dzmbs/hlz/main/install.sh | sh

Or build from source:

git clone https://github.com/dzmbs/hlz
cd hlz
zig build -Doptimize=ReleaseSmall
# Binary at zig-out/bin/hlz

Configure

Set your private key:

# Option 1: Environment variable
export HL_KEY="your_private_key_hex"
 
# Option 2: Encrypted keystore (recommended)
hlz keys new default
# Enter password when prompted
 
# Option 3: Config file
echo 'HL_KEY=your_private_key_hex' > .env
# Or system-wide: ~/.hl/config (same key=value format)

Your First Commands

No authentication needed for market data:

hlz price BTC              # Current price + spread
hlz funding --top 5        # Top funding rates
hlz book ETH --live        # Live order book

Place a trade:

hlz buy BTC 0.1 @50000     # Limit buy 0.1 BTC at $50,000
hlz sell ETH 1.0            # Market sell 1 ETH

Check your account:

hlz portfolio               # Positions + balances
hlz orders                  # Open orders

Launch the trading terminal:

hlz trade BTC               # Full TUI with chart, book, tape

Use as a Zig Library

Add to your build.zig.zon:

.dependencies = .{
    .hlz = .{
        .url = "git+https://github.com/dzmbs/hlz#main",
    },
},

Then in your code:

const hlz = @import("hlz");
const client = hlz.hypercore.client.Client.mainnet(allocator);
defer client.deinit();
 
// Fetch all mid prices (no auth needed)
var result = try client.getAllMids(null);
defer result.deinit();
// result.value is a parsed response

Next Steps