Skip to content

quiknode-labs/hyperliquid-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hyperliquid SDK

Community SDKs by QuickNode — Not affiliated with Hyperliquid Foundation.

The simplest way to trade on Hyperliquid. One line to place orders, zero ceremony.

Available SDKs

Language Package Registry
Python pip install hyperliquid-sdk PyPI
TypeScript npm install @quicknode/hyperliquid-sdk npm
Rust cargo add quicknode-hyperliquid-sdk crates.io
Go go get github.com/quiknode-labs/hyperliquid-sdk/go GitHub

Quick Example

Python

from hyperliquid_sdk import HyperliquidSDK

sdk = HyperliquidSDK(endpoint)
order = sdk.market_buy("BTC", notional=100)  # Buy $100 of BTC

TypeScript

import { HyperliquidSDK } from '@quicknode/hyperliquid-sdk';

const sdk = new HyperliquidSDK(endpoint);
const order = await sdk.marketBuy("BTC", { notional: 100 });

Rust

use hyperliquid_sdk::HyperliquidSDK;

let sdk = HyperliquidSDK::new().endpoint(endpoint).build().await?;
let order = sdk.market_buy("BTC").await.notional(100.0).await?;

Go

import "github.com/quiknode-labs/hyperliquid-sdk/go/hyperliquid"

sdk, _ := hyperliquid.New(endpoint, hyperliquid.WithPrivateKey(privateKey))
order, _ := sdk.MarketBuy("BTC", hyperliquid.WithNotional(100))

Features

All SDKs share the same design philosophy:

  • One-line orders — No build-sign-send ceremony
  • Size or notional — Specify size in asset units or USD
  • Order priority — Set Hyperliquid priorityFee and fund it with cDeposit
  • HIP-4 prediction markets — Discover readable markets, pick yes/no, and trade without memorizing #10
  • Order management — Modify, cancel, track orders
  • Position management — Close positions with one call
  • Clear errors — Actionable error messages with guidance
  • HIP-3 support — Same API for HIP-3 markets

HIP-4 Prediction Markets

Use discovery first, then trade the returned side object. HIP-4 markets use USDH collateral, whole-contract sizes, a 10 USDH minimum order value, and do not support order priority fees.

markets = sdk.prediction_markets()
market = markets.find(underlying="BTC", target_price="78213")

sdk.buy_usdh(10.7)                         # USDC -> USDH collateral
sdk.buy(market.yes, size=20, price="0.63") # no #10 memorization
sdk.sell(market.yes, size=20, price="0.64")
const markets = await sdk.predictionMarkets();
const market = markets.findMarket({ underlying: "BTC", targetPrice: "78213" });

await sdk.buyUsdh(10.7);
await sdk.buy(market!.yes, { size: 20, price: "0.63" });

Links

Disclaimer

These are unofficial community SDKs developed and maintained by QuickNode. They are not affiliated with, endorsed by, or associated with Hyperliquid Foundation or Hyperliquid Labs.

Use at your own risk. Always review transactions before signing. QuickNode is not responsible for any losses incurred through use of these SDKs.

License

MIT License - see LICENSE for details.