# Hyperliquid Trading

> This skill should be used when the user wants to trade on Hyperliquid — check balances, positions, prices, funding rates, order books, place/cancel orders, set leverage, or review trade history.

- Skill: `akegaviar/hyperliquid-trading` (Agent Skill)
- Install (CLI): `npx skillmds@latest add akegaviar/hyperliquid-trading`
- Raw SKILL.md: https://api.skillmd.com/api/skills/akegaviar/hyperliquid-trading/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: akegaviar (https://skillmd.com/u/akegaviar)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/akegaviar/hyperliquid-trading

---


# Hyperliquid Trading

Requires: `hl` CLI on PATH (`uv tool install hyperliquid-cli`). Auth via `HL_PRIVATE_KEY` env var (API wallet — can trade, cannot withdraw). Read commands work without auth using `--address 0x...`.

## Portfolio

- `hl status` — full overview (balance + positions + orders)
- `hl balance` — account value, margin used, withdrawable
- `hl positions` — open positions with P&L, leverage, liquidation price
- `hl positions BTC` — filter to one asset
- `hl orders` — open/pending orders

## Market Data

- `hl prices BTC ETH` — mid, mark, oracle, 24h change
- `hl prices` — all mid prices
- `hl assets` — all tradeable perps with volume, OI, funding
- `hl assets TSLA` — search by name (auto-resolves HIP-3 names)
- `hl assets --sort volume` — sort by volume, oi, or name
- `hl book BTC --depth 10` — order book levels
- `hl funding BTC` — current funding rate
- `hl funding BTC --history --limit 24` — historical funding
- `hl candles BTC 1h --limit 50` — OHLCV (intervals: 1m 5m 15m 1h 4h 1d 1w)

## Orders

- `hl order BTC buy 0.1 95000` — limit buy
- `hl order BTC buy 0.1 --market` — market buy
- `hl order ETH sell 1.5 --market --reduce-only` — close position
- `hl order BTC buy 0.1 95000 --tp 100000 --sl 90000` — limit with TP/SL
- Side aliases: `buy`/`long`, `sell`/`short`
- Asset names auto-resolve (e.g. `TSLA` to `xyz:TSLA`)

## Cancel

- `hl cancel 77738308` — cancel by order ID
- `hl cancel BTC 77738308` — cancel with explicit asset (faster)
- `hl cancel-all` — cancel all open orders
- `hl cancel-all BTC` — cancel only BTC orders

## Leverage

- `hl leverage BTC 10` — set cross leverage
- `hl leverage NVDA 5 --isolated` — set isolated leverage

## Trade History

- `hl fills` — last 20 fills from exchange API
- `hl fills BTC --limit 50` — filter by asset
- `hl fills --start 2026-03-10 --end 2026-03-11` — time range
- `hl trades` — last 20 from local log (`data/trades.jsonl`)

All output is JSON to stdout. Use `--fields` to project specific fields. Global flags (`--testnet`, `--fields`, `--verbose`) go before the subcommand. Exit code 5 means order rejected. Every `hl order` logs to `data/trades.jsonl`.

