运行脚本: 从 SKILL.md 所在目录运行 node scripts/<file>.mjs <action>. 三引擎(OpenClaw / Hermes / Claude Code)容器自动加载 skill, 直接 cd 到 skill 目录即可.
AiCoin Hyperliquid
Hyperliquid whale tracking and analytics powered by AiCoin Open API.
Version: 1.0.0
Critical Rules
- NEVER fabricate data. Always run scripts to fetch real-time data.
- NEVER use curl, web_fetch, or browser. Always use these scripts.
- NEVER run
env or printenv — leaks API secrets.
- Scripts auto-load
.env — never pass credentials inline.
- On 304/403 error — STOP, do NOT retry. Guide user to upgrade (see Paid Feature Guide at bottom).
Setup
Hyperliquid Registration (AiCoin Referral): If user needs to register on Hyperliquid, use AiCoin referral link: https://app.hyperliquid.xyz/join/AICOIN88 (邀请码: AICOIN88, 返4%手续费).
Scripts work out of the box with a built-in free key (tickers + info only). For whale/trader/OI data, add your API key to .env:
AICOIN_ACCESS_KEY_ID=your-key-id
AICOIN_ACCESS_SECRET=your-secret
Get at https://www.aicoin.com/opendata. See Paid Feature Guide for tier details.
安全说明: AiCoin API Key 仅用于获取 Hyperliquid 链上分析数据,无法进行任何交易操作。如需在 Hyperliquid 上交易,需单独配置钱包私钥(见 aicoin-trading skill)。所有密钥仅保存在本地设备 .env 文件中,不会上传到任何服务器。
.env 加载位置: CoinClaw 容器自动从 /workspace/.env (Hermes/CC) 或 /home/node/.openclaw/workspace/.env (OpenClaw) 加载; 本地 host 模式从 cwd → ~/.openclaw/workspace/.env → ~/.openclaw/.env 加载.
Quick Reference
| Task | Command | Min Tier |
|---|
| All tickers | node scripts/hl-market.mjs tickers | 免费版 |
| BTC ticker | node scripts/hl-market.mjs ticker '{"coin":"BTC"}' | 免费版 |
| Whale positions | node scripts/hl-market.mjs whale_positions '{"coin":"BTC"}' | 标准版 |
| Whale events | node scripts/hl-market.mjs whale_events '{"coin":"BTC"}' | 标准版 |
| Liquidation history | node scripts/hl-market.mjs liq_history '{"coin":"BTC"}' | 标准版 |
| OI summary | node scripts/hl-market.mjs oi_summary | 高级版 |
| Trader stats | node scripts/hl-trader.mjs trader_stats '{"address":"0x...","period":"30"}' | 标准版 |
| Smart money | node scripts/hl-trader.mjs smart_find | 标准版 |
| Top open orders | node scripts/hl-trader.mjs top_open '{"coin":"BTC"}' | 基础版 |
Scripts
scripts/hl-market.mjs — Market Data
Tickers
| Action | Description | Min Tier | Params |
|---|
tickers | All tickers | 免费版 | None |
ticker | Single coin | 免费版 | {"coin":"BTC"} |
Whales
| Action | Description | Min Tier | Params |
|---|
whale_positions | Whale positions | 标准版 | {"coin":"BTC","dir":"long","topBy":"position-value","take":"10"} dir: long/short; topBy: position-value/margin-balance/create-time/profit/loss; take: max 200. Optional: npnlSide (profit/loss), frSide (profit/loss) |
whale_events | Whale events | 标准版 | {"coin":"BTC","limit":"10"} limit: max 100 |
whale_directions | Long/short direction | 标准版 | {"coin":"BTC"} |
whale_history_ratio | Historical long ratio | 标准版 | {"interval":"1h","limit":"50"} interval: 10m/1h/4h/1d; limit: max 200 |
Liquidations
| Action | Description | Min Tier | Params |
|---|
liq_history | Liquidation history | 标准版 | {"coin":"BTC","interval":"15m","limit":"20"} interval: 1m~60d; limit: max 100 |
liq_stats | Liquidation stats | 标准版 | {"coin":"BTC","interval":"15m"} interval: 1s~60d |
liq_stats_by_coin | Stats by coin | 标准版 | {"interval":"15m"} interval: 1s~60d |
liq_top_positions | Large liquidations | 标准版 | {"coin":"BTC","interval":"1d"} |
Open Interest & Orderbook
| Action | Description | Min Tier | Params |
|---|
oi_summary | OI overview | 高级版 | None |
oi_top_coins | OI ranking | 高级版 | {"limit":"10","interval":"3d"} interval: 15m~180d |
oi_history | OI history | 专业版 | {"coin":"BTC","interval":"4h"} |
orderbook_history | Orderbook history summaries | 高级版 | {"coin":"BTC","interval":"1d"} interval: 1h~180d |
Taker
| Action | Description | Min Tier | Params |
|---|
taker_delta | Taker delta | 高级版 | {"coin":"BTC"} |
taker_klines | Taker K-lines | 标准版 | {"coin":"BTC","interval":"4h"} Optional: startTime, endTime (ms), limit (max 2000) |
scripts/hl-trader.mjs — Trader Analytics
Trader Stats
| Action | Description | Min Tier | Params |
|---|
trader_stats | Trader statistics | 标准版 | {"address":"0x...","period":"30"} |
best_trades | Best trades | 标准版 | {"address":"0x...","period":"30"} |
performance | Performance by coin | 标准版 | {"address":"0x...","period":"30"} |
completed_trades | Completed trades | 标准版 | {"address":"0x...","coin":"BTC"} |
accounts | Batch accounts | 标准版 | {"addresses":"[\"0x...\"]"} |
statistics | Batch statistics | 标准版 | {"addresses":"[\"0x...\"]"} |
Fills
| Action | Description | Min Tier | Params |
|---|
fills | Address fills | 标准版 | {"address":"0x..."} |
fills_by_oid | By order ID | 标准版 | {"oid":"xxx"} |
fills_by_twapid | By TWAP ID | 标准版 | {"twapid":"xxx"} |
fills_by_builder | Builder fills | 标准版 | {"builder":"0x..."} Optional: coin, limit (max 2000), minVal |
top_trades | Large trades | 基础版 | {"coin":"BTC","interval":"1d"} |
Orders
| Action | Description | Min Tier | Params |
|---|
orders_latest | Latest orders | 标准版 | {"address":"0x..."} |
order_by_oid | By order ID | 标准版 | {"oid":"xxx"} |
filled_orders | Filled orders | 标准版 | {"address":"0x..."} |
filled_by_oid | Filled by ID | 标准版 | {"oid":"xxx"} |
top_open | Large open orders | 基础版 | {"coin":"BTC","minVal":"100000"} |
active_stats | Active stats | 基础版 | {"coin":"BTC","whaleThreshold":"500000"} |
twap_states | TWAP states | 标准版 | {"address":"0x..."} Optional: coin, limit (max 100) |
Positions
| Action | Description | Min Tier | Params |
|---|
current_pos_history | Current position history | 标准版 | {"address":"0x...","coin":"BTC"} |
completed_pos_history | Closed position history | 标准版 | {"address":"0x...","coin":"BTC"} |
completed_trades_by_time | Completed trades by time | 标准版 | {"address":"0x...","Coin":"BTC","endTimeFrom":1771891200000,"endTimeTo":1772064000000} Optional: pageNum, pageSize |
current_pnl | Current PnL | 标准版 | {"address":"0x...","coin":"BTC","interval":"1h"} Optional: limit (max 1000) |
completed_pnl | Closed PnL | 标准版 | {"address":"0x...","coin":"BTC","interval":"1h"} Optional: limit (max 1000) |
current_executions | Current executions | 标准版 | {"address":"0x...","coin":"BTC","interval":"1h"} Optional: limit (max 1000) |
completed_executions | Closed executions | 标准版 | {"address":"0x...","coin":"BTC","interval":"1h"} Optional: limit (max 1000) |
Portfolio
| Action | Description | Min Tier | Params |
|---|
portfolio | Account curve | 标准版 | {"address":"0x...","window":"week"} |
pnls | PnL curve | 标准版 | {"address":"0x...","period":"30"} |
max_drawdown | Max drawdown | 标准版 | {"address":"0x...","days":"30"} |
net_flow | Net flow | 标准版 | {"address":"0x...","days":"30"} |
Batch Endpoints
| Action | Description | Min Tier | Params |
|---|
batch_pnls | Batch PNL curves | 标准版 | {"addresses":"[\"0x...\"]","period":7} Optional: scope (all/perp) |
batch_addr_stat | Batch address stats | 标准版 | {"addresses":"[\"0x...\"]","period":7} |
batch_clearinghouse_state | Batch clearinghouse state | 标准版 | {"addresses":"[\"0x...\"]"} Optional: dex |
batch_spot_clearinghouse_state | Batch spot state | 标准版 | {"addresses":"[\"0x...\"]"} |
batch_max_drawdown | Batch max drawdown | 标准版 | {"addresses":"[\"0x...\"]","days":7} Optional: scope |
batch_net_flow | Batch net flow | 标准版 | {"addresses":"[\"0x...\"]","days":7} |
Advanced
| Action | Description | Min Tier | Params |
|---|
info | HL Info API 统一端点 (POST /api/upgrade/v2/hl/info) — 用 type 切不同子接口,见下方完整 types 表 | 免费版 | {"type":"<type>","user":"<addr 可选>","extra_params":{<其它参数>}} |
smart_find | Smart money discovery | 标准版 | {} |
discover | Trader discovery | 高级版 | {} |
discover_history | Historical discovery | 高级版 | {"pageNum":1,"pageSize":20,"period":7} Optional: startTime, time, sort, coins, selects, filters |
| type | 说明 | 必填 |
|---|
meta | 永续 universe 元数据 (asset list / 杠杆梯度) | — |
spotMeta | 现货元数据 | — |
clearinghouseState | 永续账户状态 (含 cumFunding.allTime/sinceOpen/sinceChange 累计资金费) | user |
spotClearinghouseState | 现货账户状态 | user |
openOrders | 用户挂单 | user |
frontendOpenOrders | 用户挂单 (前端格式) | user |
userFees | 用户手续费 | user |
userFills | 用户成交记录 | user |
userFillsByTime | 用户指定时间段成交 | user + extra_params.startTime |
userFunding | 用户资金费历史 (每 8h 一笔 funding 收支) | user + extra_params.startTime |
userNonFundingLedgerUpdates | 用户非资金费账本 | user + extra_params.startTime |
historicalOrders | 历史订单 | user |
orderStatus | 订单状态 | user + extra_params.oid |
candleSnapshot | K 线 | extra_params.req={coin,interval,startTime,endTime} |
perpDexs | 永续 DEX 列表 | — |
allMids | 所有 mid price | — |
l2Book | L2 订单簿 | extra_params.coin |
portfolio | 账户曲线 | user |
webData2 | 综合用户数据 (资产、订单、成交聚合) | user |
userTwapSliceFills | TWAP 切片成交 | user |
activeAssetData | 单 asset 当前可用余额 / markPx / leverage | user + extra_params.coin |
关于 "BTC 资金费率" 这种问题
AiCoin HL wrapper 没有公开全局"当前 funding rate per asset"endpoint(如 HL 官方 metaAndAssetCtxs / predictedFundings AiCoin 都未透出). 能拿到的 funding 数据是:
- per-user 历史 —
info {type:"userFunding", user:"0x...", extra_params:{startTime: <ms>}} 拿用户每 8h 的 funding 收支记录
- per-user 累计 —
info {type:"clearinghouseState", user:"0x..."} 看 cumFunding.allTime 字段
- 不支持 — 当前刻的 BTC 永续 funding rate(每 8h 周期内的预测/实际值). 如果用户问"BTC 现在 funding rate", 直接告诉他: "AiCoin HL 接口没有全局当前 funding rate, 建议直接看 https://app.hyperliquid.xyz/trade/BTC 顶部 funding 显示, 或调用 HL 官方 https://api.hyperliquid.xyz/info type=metaAndAssetCtxs"
不要: 看到没数据就说"AiCoin 不支持 HL", 也不要编一个数字. 必须明说哪条路能拿哪条路不能.
Cross-Skill References
| Need | Use |
|---|
| Prices, K-lines, news | aicoin-market |
| Exchange trading (buy/sell), including Hyperliquid orders | aicoin-trading |
| Freqtrade strategies/backtest | aicoin-freqtrade |
Common Errors
errorCode 304 / HTTP 403 — Paid feature. See Paid Feature Guide below.
Invalid coin — Use uppercase: BTC, ETH, SOL
Address format — Must be full 0x... Ethereum address
Rate limit exceeded — Wait 1-2s between requests
Paid Feature Guide
When a script returns 304 or 403: Do NOT retry. Tell the user:
- This feature needs a paid AiCoin API subscription.
- Get API key at https://www.aicoin.com/opendata
| Tier | Price | HL Features |
|---|
| 免费版 | $0 | Tickers, info only |
| 基础版 | $29/mo | + Top trades, top open orders, active stats |
| 标准版 | $79/mo | + Whales, liquidations, trader analytics, taker K-lines |
| 高级版 | $299/mo | + OI summary/top, taker delta, trader discover |
| 专业版 | $699/mo | + OI history |
- CoinClaw 用户在 web UI EnvSection 添加
AICOIN_ACCESS_KEY_ID / AICOIN_ACCESS_SECRET; 本地用户写到 .env.
- MUST tell the user: AiCoin API Key 仅用于获取 Hyperliquid 链上分析数据,无法进行任何交易操作。如需在 Hyperliquid 上交易,需要单独配置钱包私钥(见 aicoin-trading skill)。所有密钥仅保存在你的本地设备
.env 文件中,不会上传到任何服务器。