Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
hlz — Zig Tooling for Hyperliquid
hlz
Zig Tooling for Hyperliquid
curl -fsSL https://raw.githubusercontent.com/dzmbs/hlz/main/install.sh | sh

SDK, CLI, and trading terminal for Hyperliquid — written in Zig. 38 commands, pipe-aware output, three-thread trading terminal.

hlz terminal demo
SDK

Sign & Place an Order

const hlz = @import("hlz");
const Signer = hlz.crypto.signer.Signer;
const Decimal = hlz.math.decimal.Decimal;
const types = hlz.hypercore.types;
const signing = hlz.hypercore.signing;
 
// Initialize signer from private key
const signer = try Signer.fromHex("your_64_char_hex_key");
 
// Build an order — all types are compile-time checked
const order = types.OrderRequest{
    .asset = 0,  // BTC
    .is_buy = true,
    .limit_px = try Decimal.fromString("50000"),
    .sz = try Decimal.fromString("0.1"),
    .reduce_only = false,
    .order_type = .{ .limit = .{ .tif = .Gtc } },
    .cloid = types.ZERO_CLOID,
};
 
const batch = types.BatchOrder{
    .orders = &[_]types.OrderRequest{order},
    .grouping = .na,
};
 
// Sign (~34µs, stack only, no heap allocations)
const nonce = @as(u64, @intCast(std.time.milliTimestamp()));
const sig = try signing.signOrder(signer, batch, nonce, .mainnet, null, null);
 
// Submit via typed HTTP client
var client = hlz.hypercore.client.Client.mainnet(allocator);
defer client.deinit();
var result = try client.place(signer, batch, nonce, null, null);
defer result.deinit();
CLI

Or Just Use the Command Line

# Market data — no auth needed
hlz price BTC
hlz book ETH --live
hlz funding --top 10
 
# Trade
hlz buy BTC 0.1 @50000 --tp 55000 --sl 48000
hlz sell ETH 1.0
 
# Stream real-time data
hlz stream trades BTC | jq '.sz'
 
# Pipe-aware: JSON when piped, tables on TTY
hlz positions --json | jq '.[] | {coin, pnl}'
At a Glance

Numbers

827 KB
hlz binary
38
commands
~15k
lines of Zig

Zig×Hyperliquid

Inspired by hypersdk, hyperliquid-cli, and zabi.