For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDKs

Python and TypeScript SDKs for trading on HyperLink, the prime broker for Hyperliquid, using Hyperliquid-compatible signing and order formats throughout.

Use the HyperLink Python SDK for Python integrations. For other languages, use a Hyperliquid SDK pointed at the HyperLink base URL because HyperLink mirrors Hyperliquid's /exchange action format and EIP-712 signing.

The HyperLink Python SDK is a minimal fork of hyperliquid-python-sdk. See PR #1 for the changes needed to add HyperLink support to a Hyperliquid SDK fork.

Base URL

Point clients at https://api.hyperlink.xyz. WebSocket: wss://api.hyperlink.xyz/ws.

Language
Package
Repository

TypeScript

@nktkas/hyperliquid

HyperLink requires a client order id (cloid) on every order. Pass it via the SDK's cloid parameter (Python) or the c field (TypeScript), as shown below.

TypeScript

npm install @nktkas/hyperliquid viem

Set the transport's apiUrl to the HyperLink host. Everything else matches the Hyperliquid SDK.

import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";

// Point the transport at HyperLink instead of Hyperliquid.
const transport = new HttpTransport({ apiUrl: "https://api.hyperlink.xyz" });

const wallet = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);

// Signed trading actions.
const exchange = new ExchangeClient({ transport, wallet });

// Place a limit order. Asset is the numeric index (perps 0-9999, spot 10000+index).
const result = await exchange.order({
  orders: [
    {
      a: 0,             // asset index
      b: true,          // isBuy
      p: "50000",       // limit price
      s: "0.1",         // size
      r: false,         // reduceOnly
      t: { limit: { tif: "Gtc" } },
      c: "0x1234567890abcdef1234567890abcdef", // cloid (required)
    },
  ],
  grouping: "na",
});

console.log(result);

For streaming, set the WebSocket transport's url to the HyperLink WS endpoint:

Python

Pass base_url="https://api.hyperlink.xyz" to the Exchange constructor.

Parameter
Required
Description

wallet

Required

An eth_account local account that signs actions. Use an approved agent (API key) for trading.

base_url

Optional

Set to a HyperLink host when you need to override the default.

Discovering asset indexes

There is no HyperLink asset-mapping endpoint. Discover perp and spot indexes through Hyperliquid's /info meta and spotMeta responses, then use those indexes in HyperLink order actions.

Market
Index range

Perps

0-9999

Spot

10000 + index

Builder perps

100000 + dex * 10000 + index

Outcome markets

Not supported

Signed private reads

The HyperLink Python SDK includes helpers for signed private reads. In other SDKs, build raw signed requests using the Authentication & Keys signing scheme:

Feature
Action / endpoint

Private balances, positions, orders, fills

clearinghouseState, spotClearinghouseState, openOrders, userFills over POST /exchange

Next steps

Last updated