Skip to main content

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

Project description

Typed Hyperliquid

PyPI version Python versions Docs License

Hyperliquid

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

from hyperliquid import Hyperliquid

async with Hyperliquid.ws(public=True) as client:
  stream = await client.streams.trades('BTC')
  async for msg in stream:
    for trade in msg:
      print(trade['px'], trade['sz'], trade['side'])

Why Typed Hyperliquid?

  • 🎯 Precise Types: Typed endpoint inputs and responses.
  • ✅ Runtime Validation: Validated responses by default.
  • ⚡ Async First: HTTP, WebSocket RPC, and subscriptions.
  • 📚 Full API Surface: client.info, client.exchange, and client.streams.

Installation

pip install typed-hyperliquid

For authenticated exchange actions, set a private key:

export HYPERLIQUID_PRIVATE_KEY="your_private_key"

Overview

Typed Hyperliquid exposes the upstream API as three client surfaces:

  • client.info: public and account read methods like all_mids, l2_book, clearinghouse_state, user_fills, and spot/perp metadata.
  • client.exchange: signed actions like placing orders, canceling orders, transfers, withdrawals, staking, TWAPs, and leverage updates.
  • client.streams: WebSocket subscriptions like trades, books, candles, user fills, user events, and open orders.

Use Hyperliquid.http() or Hyperliquid.ws() depending on the transport you want for request-response methods:

from hyperliquid import Hyperliquid

async with Hyperliquid.http() as client:
  mids = await client.info.all_mids()
  result = await client.exchange.noop()

For testnet, pass mainnet=False and set HYPERLIQUID_TESTNET_PRIVATE_KEY.

Documentation

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.3.tar.gz (53.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.3-py3-none-any.whl (116.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for typed_hyperliquid-1.0.3.tar.gz
Algorithm Hash digest
SHA256 461f2cd7b4b0fd98088cf4781aa9fc09e533330e8bd9fa96d5d7c50dfb04f2c0
MD5 d6714617340443230f42bbd17c1aeacf
BLAKE2b-256 0efffa22f80e0d55cf7cf27e9aa7fabf5a19a967233399d6bcda635e6d2d0bcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for typed_hyperliquid-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 72f82680044db0d2143b034505efcb872722069a6279ca5dd592074937ed5123
MD5 36d12b2a8492a24347d10d38c79aa118
BLAKE2b-256 5f8d12a11319bcb2ee2e41438565305b6e9e4e930ef5d6d5972b06fa035bece1

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