Skip to main content

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

Project description

Typed Hyperliquid

Hyperliquid

PyPI version Python versions Docs License

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.4.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.4-py3-none-any.whl (116.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typed_hyperliquid-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 8f25d269ff45fa48331d63860852a855aa6b392effced2d6ec9c7eda501d0430
MD5 6af9d014badd2175638dc0223aa7edcb
BLAKE2b-256 1aa4fda7347bc58eebbee149acbeedaeaa34ff50d000b5f6989454496531249e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for typed_hyperliquid-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d57e51a926fdabd9dd0d617fb28f7318ec7af4283380daafab1ea4fd97370086
MD5 72167603eca358ae7ecbf94e213db122
BLAKE2b-256 b77a6c74854eb40e05a2725fd822744a33d200d84da9d06f82f9fc50b4692d47

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