Typed Hyperliquid
A fully typed, validated async client for the Hyperliquid API.
Use autocomplete instead of documentation.
from hyperliquid import Info
async with Info.http() as info:
mids = await info.all_mids()
print(mids['BTC'])
Why Typed Hyperliquid?
- 🎯 Precise Types: Literal types where they help, so your IDE knows what is valid.
- ✅ Automatic Validation: Catch upstream API changes earlier.
- âš¡ Async First: Built for concurrent, network-heavy workflows.
- 🔒 Type Safety: Full type hints throughout.
- 🎨 Better DX: Clear routing, sensible defaults, optional complexity.
- 📦 Batteries Included: HTTP, request-response WS, streams, and exchange actions when they earn their place.
Installation
Quick Start
Public reads
Use Info for public request-response access:
from hyperliquid import Info
async with Info.http() as info:
mids = await info.all_mids()
book = await info.l2_book('BTC')
Authenticated actions
Hyperliquid auth is wallet-based, not API-key based.
from hyperliquid import Hyperliquid
async with Hyperliquid.http() as client:
result = await client.exchange.noop()
Features
No Unnecessary Imports
Notice something? You never imported custom enum objects. Just use the real values:
Precise Type Annotations
Every field is precisely typed. You can work directly with validated response objects:
from hyperliquid import Info
async with Info.http() as info:
book = await info.l2_book('BTC')
coin: str = book['coin']
time: int = book['time']
Automatic Validation
Response validation is on by default but can be disabled:
HTTP, Request-Response WS, And Streams
The package intentionally separates three transport styles:
Info.http()andExchange.http()for normal HTTP usageInfo.ws()andExchange.ws()for request-response over WebSocketStreams.new()for subscriptions
Composite Client
Use Hyperliquid.http() or Hyperliquid.ws() when you want info, exchange, and streams together:
from hyperliquid import Hyperliquid
async with Hyperliquid.http() as client:
mids = await client.info.all_mids()
API Coverage
Current coverage is split across:
Infofor info endpoint methods, perp reads, spot reads, and account readsExchangefor signed exchange actionsStreamsfor WebSocket subscriptionsHyperliquidas a convenience bundle of all three
📋 See API Overview for the current structure and coverage.
Documentation
- Getting Started - Install the package and make your first requests
- Wallet Setup - Configure wallet-based authentication
- API Overview - Understand the client structure and coverage
- Reference - Error handling, env vars, and generated endpoint docs
- Examples - Practical usage patterns
Design Philosophy
Typed Hyperliquid follows the principles outlined in this blog post.
Details matter. Developer experience matters.