返回顶部
h

hyperliquid-primeHyperliquid 主链交易

Trade on Hyperliquid's perp markets (native + HIP-3) with intelligent order routing and cross-market splitting. Use when the user wants to trade crypto, stocks, or commodities on Hyperliquid, get best execution across fragmented markets, split large orders across multiple venues, compare funding rates, view aggregated orderbooks, or manage positions across multiple collateral types. Routes across both native HL perps (ETH, BTC) and HIP-3 deployer markets. Handles collateral swaps (USDC→USDH/USDT

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.4
安全检测
已通过
1,391
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

hyperliquid-prime

Hyperliquid Prime

A TypeScript SDK that acts as a prime broker layer on top of Hyperliquid's perp markets — both native (ETH, BTC) and HIP-3 deployer markets. Automatically discovers all markets for an asset, compares liquidity/funding/cost, and routes to the best execution — or splits across multiple venues for optimal fills with automatic collateral swaps.

When to Use This Skill

  • - Trading crypto, stocks (AAPL, NVDA, TSLA), indexes, or commodities (GOLD, SILVER) on Hyperliquid
  • Need best execution across multiple perp markets (native + HIP-3) for the same asset
  • Splitting large orders across venues for better fills and lower price impact
  • Comparing funding rates across different collateral types
  • Aggregated orderbook view across fragmented markets
  • Managing positions that may be spread across multiple collateral types
  • Automatic collateral swaps (USDC → USDH, USDT0) when non-USDC markets offer better prices

Quick Start

Installation

CODEBLOCK0

Read-Only Usage (no wallet needed)

CODEBLOCK1

Trading (wallet required)

CODEBLOCK2

CLI

CODEBLOCK3

Important: Fees & Automatic Actions

Builder Fee: A 1 basis point (0.01%) builder fee is charged by default on all SDK-executed orders via Hyperliquid's native builder fee mechanism. On the first trading order from a wallet, the SDK sends an on-chain approval transaction to authorize this fee. To disable entirely, set builder: null in the config.

Collateral Swaps (Split Orders Only): When executeSplit() routes orders to non-USDC collateral markets, the SDK automatically:

  1. 1. Enables DEX abstraction on the user's account
  2. Transfers USDC from the perp account to the spot account
  3. Places a spot order to swap USDC into the required collateral token (e.g., USDH, USDT0)
  4. A 1% buffer is added to swap amounts to account for slippage

These actions only occur during split order execution and only when the best liquidity requires non-USDC collateral.

Read-Only Operations: Quotes, orderbooks, funding comparisons, and market discovery require no wallet, no fees, and perform no on-chain actions.

Credentials: Trading operations require a private key via HP_PRIVATE_KEY environment variable or the privateKey config option. The key is used to sign transactions sent to the Hyperliquid API. Source code is available for audit at .

User Confirmation Flow: The SDK uses a quote-then-execute pattern as the confirmation mechanism:

  1. 1. quote() / quoteSplit() are read-only — they return an execution plan with estimated prices, markets, and costs. No on-chain actions are taken.
  2. The caller reviews the plan (programmatically or via CLI output).
  3. INLINECODE6 / executeSplit() must be explicitly called to perform on-chain actions (place orders, approve fees, swap collateral).
  4. One-step convenience methods (long(), short(), longSplit(), shortSplit()) combine both steps — use quote-then-execute for explicit control.

Implementation Note: This skill bundle contains instructions only (SKILL.md). The SDK implementation must be installed separately via npm install hyperliquid-prime. The source code is open-source and available for audit at the GitHub repository before installation.

How Routing Works

When you call hp.quote("TSLA", "buy", 50), the router:

  1. 1. Fetches the orderbook for every TSLA market
  2. Simulates walking each book to estimate average fill price and price impact
  3. Scores each market using:
- Price impact (dominant) — cost in basis points to fill - Funding rate (secondary) — prefers favorable funding direction - Collateral swap cost (penalty) — estimated cost to swap into the required collateral
  1. 4. Selects the lowest-score market and builds an execution plan

For split orders (quoteSplit), the router merges all orderbooks, walks the combined book greedily to consume the cheapest liquidity first across all venues, and builds split execution legs. Collateral requirements and swaps are estimated and executed at executeSplit(...) time using live balances. If leverage is included in the quote options, execution applies that leverage per market leg before order placement.

For single-market orders, leverage included in quote(...) is carried into the execution plan and applied before the order is sent.

Configuration

CODEBLOCK4

Builder Fee

A 1 basis point (0.01%) builder fee is included by default on all SDK-executed orders via Hyperliquid's native builder fee mechanism. The fee is auto-approved on the trader's first order. Set builder: null to disable, or provide a custom { address, feeBps } to override.

Key Methods

Read-Only

  • - getMarkets(asset) — All perp markets for an asset (native + HIP-3)
  • INLINECODE20 — Asset groups with multiple markets
  • INLINECODE21 — Merged orderbook across all markets
  • INLINECODE22 — Funding rates compared across markets
  • INLINECODE23 — Routing quote for single best market
  • INLINECODE24 — Split quote across multiple markets

Trading (wallet required)

  • - execute(plan) — Execute a single-market quote
  • INLINECODE26 — Execute a split quote (handles collateral swaps)
  • INLINECODE27 — Quote + execute a long on best market
  • INLINECODE28 — Quote + execute a short on best market
  • INLINECODE29 — Split quote + execute a long across markets
  • INLINECODE30 — Split quote + execute a short across markets
  • INLINECODE31 — Close all positions for an asset

Trade Options

  • - leverage?: number — Positive number, e.g. 5 for 5x.
  • INLINECODE34 — Default true (cross); set false for isolated.
  • INLINECODE37 requires leverage. If leverage is omitted, no leverage-setting API call is made.

Position & Balance

  • - getPositions() — All positions with market metadata
  • INLINECODE40 — Positions grouped by base asset
  • INLINECODE41 — Account margin summary

Repository

License

MIT

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 hyperliquid-prime-1776420055 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 hyperliquid-prime-1776420055 技能

通过命令行安装

skillhub install hyperliquid-prime-1776420055

下载

⬇ 下载 hyperliquid-prime v0.1.4(免费)

文件大小: 5.45 KB | 发布时间: 2026-4-17 20:03

v0.1.4 最新 2026-4-17 20:03
- Leverage selection is now supported in quotes and trading: pass leverage and margin mode options (`leverage`, `isCross`) to all trade/quote calls, both in SDK and CLI.
- CLI examples updated to demonstrate usage of leverage and isolated/cross modes.
- Documentation improved to clarify how leverage integrates into order routing and execution plans for both single-market and split-market orders.
- No breaking changes; all prior examples remain valid.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部