Getting Started
This guide gets you from installation to your first public and authenticated Hyperliquid requests.
Install The Package
Make A Public HTTP Request
Use Info for public reads:
from hyperliquid import Info
async with Info.http() as info:
mids = await info.all_mids()
book = await info.l2_book('BTC')
Open A Public Stream
Use Streams for subscriptions:
from hyperliquid import Streams
async with Streams.new() as streams:
trades = await streams.trades('BTC')
async for batch in trades:
print(batch[0]['px'])
Make An Authenticated Request
Set your wallet private key:
Then use the composite client or Exchange directly:
from hyperliquid import Exchange, Hyperliquid
async with Hyperliquid.http() as client:
result = await client.exchange.noop()
print(result['status'])
# Or use Exchange directly if you only need signed actions:
async with Exchange.http('0xyour_private_key') as exchange:
result = await exchange.noop()
print(result['status'])
Transport Choices
Use the surface that matches what you need:
Info.http()for public request-response over HTTPInfo.ws()for public request-response over WebSocketExchange.http(wallet)orExchange.ws(wallet)for signed actionsStreams.new()for subscriptionsHyperliquid.http()orHyperliquid.ws()for the full bundle
Important Nuance
Hyperliquid.http() and Hyperliquid.ws() always require a wallet, because they include exchange.
Exchange.http() and Exchange.ws() accept either a wallet object or a raw private key.
Info and Streams never need a private key for public usage.
For public-only workflows, prefer Info or Streams directly.
Next Steps
- Read Wallet Setup before using
ExchangeorHyperliquid - Read API Overview to understand the split between
Info,Exchange,Streams, andHyperliquid - Browse How To for task-focused workflows