Partially verified. As of v0.8.7+, the critical signing issues from the
earlier audit (msgpack key ordering, cloid format, spot asset offset, error
handling, cancel-by-cloid action type) are fixed. Order submission and cancel
should now work end-to-end. Has not been tested against a live Hyperliquid
account with real funds, so verify the behavior matches expectations before
deploying significant size.
Quick Setup
Credentials
- Explicit
- Environment variables
Hyperliquid Configuration
Authentication
Hyperliquid uses EIP-712 wallet signing — no API key/secret needed, just a private key. Every write operation is signed with the wallet’s secp256k1 key using a Hyperliquid-specific EIP-712 domain:- Domain:
{name: "Exchange", version: "1", chainId: 1337, verifyingContract: 0x0} - Type:
Agent(address source, bytes32 connectionId) - Source:
keccak256("a")(mainnet) orkeccak256("b")(testnet)
POST /info— all read operations (metadata, fills, positions, prices)POST /exchange— all write operations (orders, cancels) with EIP-712 signature
Symbol Mapping
Hyperliquid identifies assets by integer indices, not ticker symbols. The SDK resolves symbols automatically via metadata on first use:Market Orders
Hyperliquid has no native market order type. The SDK implements market orders as aggressive limit IOC with 5% slippage:- Fetch current mid price via
allMids - Place limit IOC at
mid × 1.05(buy) ormid × 0.95(sell) - Unfilled portion is immediately canceled (IOC behavior)
Hyperliquid uses
Side.Long for all positions — perps and spot. Prediction market concepts like Side.Yes / Side.No do not apply.Vault Trading
For sub-account (vault) trading, specify a vault address:Testnet
https://api.hyperliquid-testnet.xyz automatically. Get testnet funds from the Hyperliquid testnet faucet.
Multi-Exchange
Use Hyperliquid alongside other exchanges:Getting Started
- Generate or use an existing EVM private key
- Fund your Hyperliquid account by depositing USDC via the Hyperliquid bridge
- Set the environment variable or pass directly:
- Start trading: