Zig Tooling for Hyperliquid
curl -fsSL https://raw.githubusercontent.com/dzmbs/hlz/main/install.sh | shSDK, CLI, and trading terminal for Hyperliquid — written in Zig. 38 commands, pipe-aware output, three-thread trading terminal.
⚡
CLI — 38 Commands
Market data, trading, transfers, streaming. Tables on TTY, JSON when piped.
📐
Typed SDK
30 HTTP endpoints, 13 WebSocket types, 62 response types. All typed Zig structs.
📈
Trading Terminal
Candlestick charts, live order book, trade tape. Three-thread architecture.
🤖
Agent-Native
Structured JSON output, semantic exit codes, dry-run mode. No interactive prompts.
🖥️
TUI Framework
Double-buffered rendering, constraint layout, scrollable lists. Standalone — no SDK dependency.
📦
827 KB Binary
Static binary, ~15k lines of Zig source. Builds in ~3 seconds.
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
Inspired by hypersdk, hyperliquid-cli, and zabi.
