Skip to main content

A fully typed, validated async client for the Hyperliquid API.

Project description

Typed Hyperliquid

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: Strong typing throughout, so your editor can help before runtime does.
  • ✅ Automatic Validation: Catch upstream API changes earlier, where they are easier to debug.
  • ⚡ Async First: Built for concurrent, network-heavy workflows.
  • 🔒 Safer Usage: Typed inputs and explicit errors reduce avoidable mistakes.
  • 🎨 Better DX: Clear routing, sensible defaults, and minimal ceremony.
  • 📦 Practical Extras: HTTP, request-response WS, streams, and exchange actions under one package.

Package Shape

This package exposes four public entry points:

  • Info for read-only request-response access to the info endpoint
  • Exchange for signed exchange actions
  • Streams for WebSocket subscriptions
  • Hyperliquid as a convenience bundle of all three

Installation

pip install typed-hyperliquid

Quick Start

Public reads

Use Info for request-response reads over HTTP:

from hyperliquid import Info

async with Info.http() as info:
  mids = await info.all_mids()
  book = await info.l2_book('BTC')
  print(mids['BTC'], book['levels'][0][0]['px'])

Public streams

Use Streams for subscription workflows:

from hyperliquid import Streams

async with Streams.new() as streams:
  trades = await streams.trades('BTC')
  async for batch in trades:
    print(batch[0]['px'])
    break

Authenticated actions

Hyperliquid auth is wallet-based, not API-key based:

export HYPERLIQUID_PRIVATE_KEY="your_private_key"
from hyperliquid import Hyperliquid

async with Hyperliquid.http() as client:
  result = await client.exchange.noop()
  print(result['status'])

Transport Model

This package intentionally separates Hyperliquid's three usage modes:

  • Info.http() and Info.ws() for read-only request-response calls
  • Exchange.http(wallet) and Exchange.ws(wallet) for signed exchange actions
  • Streams.new() for subscriptions
  • Hyperliquid.http() and Hyperliquid.ws() as convenience bundles

Exchange.http() and Exchange.ws() accept either a wallet object or a raw private key. Hyperliquid.http() and Hyperliquid.ws() also accept those forms, and can additionally read HYPERLIQUID_PRIVATE_KEY when no wallet is passed.

Documentation

Read the docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typed_hyperliquid-1.0.0.tar.gz (50.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typed_hyperliquid-1.0.0-py3-none-any.whl (110.6 kB view details)

Uploaded Python 3

File details

Details for the file typed_hyperliquid-1.0.0.tar.gz.

File metadata

  • Download URL: typed_hyperliquid-1.0.0.tar.gz
  • Upload date:
  • Size: 50.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for typed_hyperliquid-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d27356b662a7b447775e8f6df0b1b07efb6cb335f55477a58032af4b88f2ac3e
MD5 30d28d33ea83b9e0f27efa5d542884cf
BLAKE2b-256 f0fa1b3a7bee6e41f7c635988f8d4b8fcd94d58d3b8349ef8ea8b3199fd184a7

See more details on using hashes here.

File details

Details for the file typed_hyperliquid-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for typed_hyperliquid-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d3ab42c5e67322ee85f1f375875156b755ee00670481e9daf464e5db46a37a
MD5 6cf05f46d34b96330b187c8e7171246c
BLAKE2b-256 c28c1f3367331ec6298388b40fc074bcd0da19acaebfe35c8cb9137ac9e1d2d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page