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.
Base URL
Point clients at https://api.hyperlink.xyz. WebSocket: wss://api.hyperlink.xyz/ws.
TypeScript
npm install @nktkas/hyperliquid viemSet 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.
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.
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:
Private balances, positions, orders, fills
clearinghouseState, spotClearinghouseState, openOrders, userFills, userFillsByTime over POST /exchange
Next steps
Authentication & Keys: signing and agent keys.
Exchange Methods: the unified
POST /exchangeactions and schemas.API Quickstart: networks, base URLs, and your first request.
Last updated