@2oolkit/hyperliquid-cli

中文文档
0.2.7发布于 2026/06/23MIT近 30 天下载 2287

用于超液态DEX的 CLI & MCP 服务器—— 交易永久并点, 管理订单和查询市场数据

中文使用文档
文档目录25 节
  1. 安装
  2. 先决条件
  3. CLI 使用量
  4. 快速启动
  5. 配置
  6. 命令参考
  7. 输出格式
  8. MCP 服务器
  9. Claude 代码的设置
  10. Claude 桌面 / cursor / Windsurf 的设置
  11. 可用工具(25)
  12. MCP 配置
  13. OpenClaw 技能
  14. 资产名称
  15. 共同工作流程
  16. 关闭位置
  17. 括号顺序( Entry + Take- profit)
  18. 取消所有内容
  19. 组合健康检查
  20. 处理错误
  21. 安全问题
  22. 配置文件
  23. 环境变量
  24. 资源
  25. 许可证

@ 2olkit/高压液体- cli

贸易时间和地点 超液态 高性能的链上订单本 DEX 从你的终端或AI代理.

一个包,三个接口:

接口命令使用大小写
国 际hyperliquid-cli终端交易、脚本、自动化
MCP 服务器hyperliquid-mcpAI代理(克洛德,克勒索克,温德苏夫等)
OpenClaw 技能skill/SKILL.md人工智能生态系统(OpenClaw、ClawdBot)

200+ 常年用具,即时活符,TWAP订单,以及完整的账户管理.

安装

npm install -g @2oolkit/hyperliquid-cli

此两个都安装 hyperliquid-cli (CLI)和 hyperliquid-mcp (MCP服务器).

先决条件

  • 节点.js >= 20
  • A 类 超液态 钱包和存款
  • 你的钱包 私钥 (用于签署交易)

CLI 使用量

快速启动

# 1. Interactive setup (prompts for environment, private key)
hyperliquid-cli config init

# 2. Check a price (no auth needed)
hyperliquid-cli market ticker BTC

# 3. Place a limit buy
hyperliquid-cli order place -c BTC -s buy -p 60000 -z 0.001

# 4. View open orders
hyperliquid-cli order list

配置

交互式设置( 建议):

hyperliquid-cli config init

提示:

提示说明
环境mainnet 或者说 testnet
私钥十六进制私钥( 以 *(中文(简体) )

钱包地址自动取自私钥.

手动设置 :

hyperliquid-cli config set --env mainnet --private-key <hex-key>

环境变量( CI/ CD, Docker ):

export HYPERLIQUID_WALLET_PRIVATE_KEY=<your-private-key>
export HYPERLIQUID_WALLET_ADDRESS=<your-wallet-address>

查看当前配置 :

hyperliquid-cli config list
hyperliquid-cli config get env

配置被保存到 ~/.hyperliquid-cli/config.json 与 0600 权限.

命令参考

市场数据( 不需要认证)

hyperliquid-cli market meta                        # List all perpetual instruments
hyperliquid-cli market meta --spot                 # List spot instruments
hyperliquid-cli market all-mids                    # All mid prices
hyperliquid-cli market ticker BTC                  # Price, volume, funding, OI
hyperliquid-cli market ticker BTC --spot           # Spot ticker
hyperliquid-cli market orderbook BTC               # L2 order book
hyperliquid-cli market orderbook BTC -d 3          # 3 sig figs depth
hyperliquid-cli market candles BTC -i 1h -n 500    # OHLCV candles (default 500)
hyperliquid-cli market candles BTC -i 1h -n 5000   # Up to 5000 in one request
hyperliquid-cli market candles BTC -i 1h -n 10000 --paginate  # Auto-paginate for more
hyperliquid-cli market funding BTC --hours 24      # Funding rate history
hyperliquid-cli market funding BTC --predicted     # Predicted funding rates
hyperliquid-cli market trades BTC                  # Recent trades

蜡烛(OHLCV):

这个 candleSnapshot 结束点返回 每个请求最多5000个蜡烛 (滚动) 时间窗口,无光标)。 CLI 默认为 -n 500。 。 。 .

hyperliquid-cli market candles BTC -i 1h -n 5000 -o json    # Max in a single request
hyperliquid-cli market candles BTC -i 1h -n 10000 --paginate -o json  # Fetch more via auto-pagination
hyperliquid-cli market candles BTC -i 15m --start-time 1700000000000 --end-time 1700864000000 --paginate -o json
选项说明默认
-i, --interval <interval>一个 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1M1h
-n, --count <number>要获取的蜡烛数量500
--paginate自动贴上(按时间倒行走)取出5000多根蜡烛false
--start-time <ms>窗口启动 (Unix ms); 覆盖基于计数的启动—— 说
--end-time <ms>窗口端 (Unix ms)现在
  • 若为 -n 超过5000 无 --paginate计数被夹到5000 并警告.
  • 与 --paginate中,请求以 endTime = (oldest candle).t − 1ms 直至达到要求的计数或历史被耗尽;结果被去除并按时间向上排序.

命令(所需数字)

# Place orders
hyperliquid-cli order place -c BTC -s buy -p 60000 -z 0.001              # Limit buy (Gtc)
hyperliquid-cli order place -c BTC -s sell -p 80000 -z 0.001             # Limit sell
hyperliquid-cli order place -c BTC -s buy -p 70000 -z 0.001 --tif Ioc   # Immediate-or-cancel
hyperliquid-cli order place -c BTC -s buy -p 70000 -z 0.001 --tif Alo   # Post-only (add liquidity)
hyperliquid-cli order place -c BTC -s sell -z 0.001 --trigger-px 65000 --tpsl sl  # Stop-loss
hyperliquid-cli order place -c BTC -s sell -z 0.001 --reduce-only -p 80000        # Reduce-only

# Manage orders
hyperliquid-cli order list                                    # Open orders
hyperliquid-cli order get <oid>                               # Order status by ID
hyperliquid-cli order cancel -c BTC --oid <oid>               # Cancel one
hyperliquid-cli order cancel-all                              # Cancel all open orders
hyperliquid-cli order cancel-all -c BTC                       # Cancel all BTC orders only
hyperliquid-cli order modify --oid <oid> -c BTC -s buy -p 61000 -z 0.002  # Modify order

# History
hyperliquid-cli order history                                 # Order history
hyperliquid-cli order fills                                   # Recent fills
hyperliquid-cli order fills --hours 48                        # Fills from last 48h

# TWAP
hyperliquid-cli order twap -c BTC -s buy -z 0.1 -m 30        # TWAP over 30 minutes
hyperliquid-cli order twap-cancel -c BTC --twap-id <id>       # Cancel TWAP

# Dead man switch
hyperliquid-cli order schedule-cancel --delay 60              # Cancel all orders in 60s

排序位置选项 :

选项需求说明默认
-c, --coin <coin>对缩写( 例如 ), BTC, (中文(简体) ), ETH(中文(简体) )—— 说
-s, --side <side>对buy 或者说 sell—— 说
-z, --size <size>对顺序大小—— 说
-p, --price <price>对订货价格—— 说
--tif <tif>没有Gtc, (中文(简体) ), Alo (仅限员额), IocGtc
--reduce-only没有只减少false
--trigger-px <price>没有触发价格(站/TP)—— 说
--tpsl <type>没有tp 或者说 slsl
--cloid <id>没有客户端命令 ID (128- bit hex)—— 说

职位

hyperliquid-cli position list                                 # All open positions + margin
hyperliquid-cli position leverage -c BTC -l 10                # Set 10x cross leverage
hyperliquid-cli position leverage -c BTC -l 5 --isolated      # Set 5x isolated
hyperliquid-cli position margin -c BTC -s buy -a 100          # Add $100 isolated margin

账户

hyperliquid-cli account state                     # Clearinghouse state (positions + margin)
hyperliquid-cli account spot                      # Spot token balances
hyperliquid-cli account portfolio                 # Portfolio summary
hyperliquid-cli account fees                      # Fee schedule
hyperliquid-cli account rate-limit                # Rate limit status
hyperliquid-cli account sub-accounts              # Sub-accounts
hyperliquid-cli account referral                  # Referral info
hyperliquid-cli account role                      # User role

转账(所需数字)

hyperliquid-cli transfer usd-send -d <address> -a 100          # Send USDC on Hyperliquid
hyperliquid-cli transfer spot-send -d <address> -t <token> -a 10  # Send spot token
hyperliquid-cli transfer withdraw -d <address> -a 100           # Withdraw to Arbitrum (~5 min, $1 fee)
hyperliquid-cli transfer spot-to-perp -a 100                    # Spot → Perp
hyperliquid-cli transfer perp-to-spot -a 100                    # Perp → Spot
hyperliquid-cli transfer vault-deposit -v <vault> -a 100        # Vault deposit
hyperliquid-cli transfer vault-withdraw -v <vault> -a 100       # Vault withdraw
hyperliquid-cli transfer approve-agent -a <address>             # Approve API agent

输出格式

所有命令支持 -o json 用于脚本和管道:

hyperliquid-cli market ticker BTC -o json
hyperliquid-cli order list -o json | jq '.[].oid'

MCP 服务器

MCP(模式上下文协议)服务器暴露出所有Hyper Aliquid功能作为AI代理的工具. 与Claude Code, Claude Desktop, Cursor, Windsurf以及任何MCP相容客户端合作.

Claude 代码的设置

claude mcp add hyperliquid-mcp -- hyperliquid-mcp

Claude 桌面 / cursor / Windsurf 的设置

添加到您的 MCP 配置文件 :

{
  "mcpServers": {
    "hyperliquid": {
      "command": "hyperliquid-mcp"
    }
  }
}

或者没有全局安装 :

{
  "mcpServers": {
    "hyperliquid": {
      "command": "npx",
      "args": ["-y", "-p", "@2oolkit/hyperliquid-cli", "hyperliquid-mcp"]
    }
  }
}

可用工具(25)

类别工具认证
市场get_all_mids, (中文(简体) ), get_meta, (中文(简体) ), get_ticker, (中文(简体) ), get_orderbook, (中文(简体) ), get_candles, (中文(简体) ), get_funding, (中文(简体) ), get_recent_trades没有
命令place_order, (中文(简体) ), cancel_order, (中文(简体) ), list_open_orders, (中文(简体) ), get_order_status, (中文(简体) ), get_order_history, (中文(简体) ), get_user_fills对
职位list_positions, (中文(简体) ), update_leverage对
账户get_account_state, (中文(简体) ), get_spot_balances, (中文(简体) ), get_portfolio, (中文(简体) ), get_user_fees, (中文(简体) ), get_rate_limit, (中文(简体) ), get_sub_accounts对
转账usd_send, (中文(简体) ), spot_send, (中文(简体) ), withdraw, (中文(简体) ), usd_class_transfer对

MCP 配置

备选办法1:建立国家行动倡议(建议)

hyperliquid-cli config init

MCP服务器读取了与CLI相同的配置(~/.hyperliquid-cli/) (中文(简体) ).

备选案文2: MCP 配置中的环境变量

直接通过您的 MCP 配置文件中的证书—— 不需要 CLI 设置 :

{
  "mcpServers": {
    "hyperliquid": {
      "command": "hyperliquid-mcp",
      "env": {
        "HYPERLIQUID_WALLET_PRIVATE_KEY": "0x..."
      }
    }
  }
}

OpenClaw 技能

此软件包包含一个 打开Claw 人工智能代理生态系统的技能定义。 技能文件位于 skill/SKILL.md 详细参考文献 skill/references/。 。 。 .

与OpenClaw,ClawdBot等代理技能平台相兼容.


资产名称

超液态使用短币名( 不交易对) :

铜说明
BTC比特币永远
ETH永远
SOL索拉 永远
ARB永久仲裁
DOGE多吉币永远

使用 hyperliquid-cli market meta -o json 对于带有大小小数和最大杠杆的完整列表.

斑点标志使用相同名称. 添加 --spot 用于特定点命令的旗帜.

共同工作流程

关闭位置

# Long position → sell reduce-only at market
hyperliquid-cli order place -c BTC -s sell -z 0.001 -p 100000 --tif Ioc --reduce-only

# Short position → buy reduce-only at market
hyperliquid-cli order place -c ETH -s buy -z 0.01 -p 1 --tif Ioc --reduce-only

括号顺序( Entry + Take- profit)

hyperliquid-cli order place -c BTC -s buy -z 0.01 -p 68000
hyperliquid-cli order place -c BTC -s sell -z 0.01 -p 75000 --reduce-only

取消所有内容

hyperliquid-cli order cancel-all
hyperliquid-cli position list -o json
# For each position, create opposite reduce-only order

组合健康检查

hyperliquid-cli account state -o json
hyperliquid-cli position list -o json
hyperliquid-cli order list -o json

处理错误

错误包括可操作的回收指令:

Error: Private key is not configured.

Try: hyperliquid-cli config init
错误恢复
Private key is not configuredhyperliquid-cli config init
Asset "XXX" not found检查 hyperliquid-cli market meta
Invalid leverage使用有效的整数
Exchange API error检查错误消息的细节

安全问题

  1. 使用 --reduce-only 离职单 - 防止意外位置翻转
  2. 检查仪器规格 —— 说 hyperliquid-cli market meta -o json 大小小数和最大杠杆
  3. 从小尺寸开始 测试时
  4. 永远不要暴露你的私钥 ——配置文件使用 0600 权限,密钥在输出中被遮盖
  5. 先使用测试网 —— 说 hyperliquid-cli config set --env testnet

配置文件

文件路径说明
配置~/.hyperliquid-cli/config.json环境、 私钥、 钱包地址

配置用途 0600 权限(所有者只读/写)。 私人密钥显示时会被遮住 .

环境变量

变量说明
HYPERLIQUID_WALLET_PRIVATE_KEY私钥( 覆盖配置文件)
HYPERLIQUID_WALLET_ADDRESS钱包地址( 覆盖配置文件)
HYPERLIQUID_ENVmainnet 或者说 testnet (默认 : mainnet(中文(简体) )

资源

许可证

麻省理工学院

版本与发布记录

@2oolkit/hyperliquid-cli 共发布 9 个版本,首次发布于 2026/03/15;过去 12 个月发布了 9 个版本。

版本发布日期距今
0.2.7latest2026/06/234 个月前
0.2.62026/03/267 个月前
0.2.52026/03/197 个月前
0.2.42026/03/197 个月前
0.2.32026/03/187 个月前
0.2.22026/03/187 个月前

关于 @2oolkit/hyperliquid-cli 的常见问题

@2oolkit/hyperliquid-cli 是什么?

用于超液态DEX的 CLI & MCP 服务器—— 交易永久并点, 管理订单和查询市场数据

如何安装 @2oolkit/hyperliquid-cli?

在项目目录运行 npm install @2oolkit/hyperliquid-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 hyperliquid-cli、hyperliquid-mcp,可以用 npx hyperliquid-cli 直接运行。

@2oolkit/hyperliquid-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/2oolkit__hyperliquid-cli 是否存在。

@2oolkit/hyperliquid-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@2oolkit/hyperliquid-cli 可以商用吗?

@2oolkit/hyperliquid-cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@2oolkit/hyperliquid-cli 的下载量有多少?

根据 npm 官方下载统计,@2oolkit/hyperliquid-cli 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,287 次,日均约 76 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@2oolkit/hyperliquid-cli 还在维护吗?

最新版本 0.2.7 发布于 2026/06/23(4 个月前);至今共发布 9 个版本,其中过去 12 个月发布了 9 个;首次发布于 2026/03/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。