@ 2olkit/高压液体- cli
贸易时间和地点 超液态 高性能的链上订单本 DEX 从你的终端或AI代理.
一个包,三个接口:
| 接口 | 命令 | 使用大小写 |
|---|---|---|
| 国 际 | hyperliquid-cli | 终端交易、脚本、自动化 |
| MCP 服务器 | hyperliquid-mcp | AI代理(克洛德,克勒索克,温德苏夫等) |
| 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, 1M | 1h |
-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 (仅限员额), Ioc | Gtc |
--reduce-only | 没有 | 只减少 | false |
--trigger-px <price> | 没有 | 触发价格(站/TP) | —— 说 |
--tpsl <type> | 没有 | tp 或者说 sl | sl |
--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 configured | hyperliquid-cli config init |
Asset "XXX" not found | 检查 hyperliquid-cli market meta |
Invalid leverage | 使用有效的整数 |
Exchange API error | 检查错误消息的细节 |
安全问题
- 使用
--reduce-only离职单 - 防止意外位置翻转 - 检查仪器规格 —— 说
hyperliquid-cli market meta -o json大小小数和最大杠杆 - 从小尺寸开始 测试时
- 永远不要暴露你的私钥 ——配置文件使用
0600权限,密钥在输出中被遮盖 - 先使用测试网 —— 说
hyperliquid-cli config set --env testnet
配置文件
| 文件 | 路径 | 说明 |
|---|---|---|
| 配置 | ~/.hyperliquid-cli/config.json | 环境、 私钥、 钱包地址 |
配置用途 0600 权限(所有者只读/写)。 私人密钥显示时会被遮住 .
环境变量
| 变量 | 说明 |
|---|---|
HYPERLIQUID_WALLET_PRIVATE_KEY | 私钥( 覆盖配置文件) |
HYPERLIQUID_WALLET_ADDRESS | 钱包地址( 覆盖配置文件) |
HYPERLIQUID_ENV | mainnet 或者说 testnet (默认 : mainnet(中文(简体) ) |
资源
- 超液态数字 : https://hyper liquid.xyz (英语)
- npm 软件包: https://www.npmjs.com/package/@2olkit/hyper 液态-cli
- GitHub 图像数字 : https://github.com/haeminmoon/hyper 液态-cli
- 超液态API 文档数字 : https://hyper volic.gitbook.io/hyper volic-docs (英语)
许可证
麻省理工学院