Examples using the Hyperliquid SDK for Python.
pip install hyperliquid-sdk# Set your private key (for trading examples)
export PRIVATE_KEY="0x..."
# Set your endpoint (for data examples)
export ENDPOINT="https://your-endpoint.hype-mainnet.quiknode.pro/YOUR_TOKEN"
# Run any example
python market_order.py| File | Description |
|---|---|
| market_order.py | Market buy/sell that executes immediately |
| place_order.py | Limit order that rests on the book |
| fluent_builder.py | Power user fluent API for orders |
| hip3_order.py | Trade HIP-3 markets (community perps) |
| File | Description |
|---|---|
| cancel_order.py | Cancel an order by OID |
| cancel_by_cloid.py | Cancel by client order ID |
| cancel_all.py | Cancel all open orders |
| schedule_cancel.py | Dead-man's switch auto-cancel |
| modify_order.py | Modify a resting order |
| File | Description |
|---|---|
| close_position.py | Close a position completely |
| roundtrip.py | Buy then sell (complete cycle) |
| File | Description |
|---|---|
| info_market_data.py | Mid prices, order book, recent trades |
| info_user_data.py | Account state, positions, orders |
| info_candles.py | OHLCV candlestick data |
| info_vaults.py | Vault summaries and details |
| info_batch_queries.py | Batch queries for multiple users |
| File | Description |
|---|---|
| hypercore_blocks.py | Blocks, trades, and order events |
| File | Description |
|---|---|
| evm_basics.py | Chain ID, blocks, balances |
| File | Description |
|---|---|
| stream_trades.py | WebSocket streaming basics (trades, L2 book, all mids, BBO) |
| stream_grpc.py | gRPC streaming basics (trades, L2/L4 book, blocks) |
| stream_orderbook.py | L2 and L4 order book comparison |
| stream_l4_book.py | L4 order book (individual orders) — CRITICAL |
| stream_l2_book.py | L2 order book (gRPC vs WebSocket) |
| stream_websocket_all.py | Complete WebSocket reference (20+ subscription types) |
| File | Description |
|---|---|
| markets.py | List all markets and DEXes |
| open_orders.py | View open orders |
| preflight.py | Validate orders before signing |
| approve.py | Manage builder fee approval |
| File | Description |
|---|---|
| full_demo.py | All features in one file |
- SDK on PyPI: https://pypi.org/project/hyperliquid-sdk/
- SDK Repository: https://github.com/quiknode-labs/hyperliquid-sdk
- SDK Documentation: https://hyperliquidapi.com/docs
- QuickNode Docs: https://www.quicknode.com/docs/hyperliquid