hyperliquid by starchild-ai-agent/official-skills
npx skills add https://github.com/starchild-ai-agent/official-skills --skill hyperliquid在 Hyperliquid 这个完全链上去中心化交易所上交易永续合约和现货代币。订单使用此代理的 EVM 钱包进行签名,并直接提交到 Hyperliquid L1。
开始交易前,钱包策略必须处于激活状态。加载 wallet-policy 技能并提议标准通配符策略(拒绝密钥导出 + 允许 *)。这涵盖了所有 Hyperliquid 操作——USDC 存款、EIP-712 订单签名和提款。
| 工具 | 功能 |
|---|---|
hl_total_balance | 检查可用于交易的资金量(用这个来检查余额!) |
hl_account | 查看您的未平仓头寸和盈亏 |
hl_balances | 查看您的代币持有量(USDC、HYPE 等) |
hl_market |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 获取加密货币或股票的当前价格 |
hl_orderbook | 检查订单簿深度和流动性 |
hl_fills | 查看最近的成交记录和执行价格 |
hl_candles | 获取价格图表(1分钟、5分钟、1小时、4小时、1天) |
hl_funding | 检查永续合约的资金费率 |
hl_open_orders | 查看待处理订单 |
| 工具 | 功能 |
|---|---|
hl_order | 买卖永续合约(加密货币/股票) |
hl_spot_order | 买卖现货代币 |
hl_tpsl_order | 下达止损或止盈订单 |
hl_leverage | 设置杠杆(1倍至资产最大值) |
hl_cancel | 取消特定订单 |
hl_cancel_all | 取消所有未成交订单 |
hl_modify | 更改订单价格或数量 |
| 工具 | 功能 |
|---|---|
hl_deposit | 从 Arbitrum 存入 USDC(最低 $5) |
hl_withdraw | 将 USDC 发送到 Arbitrum(1 USDC 手续费,约 5 分钟) |
hl_transfer_usd | 在现货/永续合约账户间转移 USDC(很少需要) |
只需告诉代理您想交易什么 - 它会自动处理一切。
示例:
User: "用 5 倍杠杆买入 $20 的比特币"
Agent: [检查余额 → 设置杠杆 → 下达订单 → 报告成交]
Result: "✓ 以 $95,432 的价格买入 0.0002 BTC,使用 5 倍杠杆。头寸已开立。"
User: "用 $50,10 倍杠杆做多 NVIDIA"
Agent: [自动检测 NVIDIA = xyz:NVDA → 执行 → 验证]
Result: "✓ 以 $198.50 的价格买入 0.25 NVDA,使用 10 倍杠杆。成交价 $198.62。"
User: "卖出我的 ETH 头寸"
Agent: [检查头寸大小 → 平仓 → 报告盈亏]
Result: "✓ 以 $3,421 的价格卖出 0.5 ETH。已实现盈亏:+$12.50"
您不需要:
只需说出您想要的,代理会处理其余部分。
🤖 作为代理,您应该始终自动执行以下操作(永远不要询问用户):
hl_total_balance 查看总可用保证金hl_leverage(除非用户明确指定不设置)hl_fills 检查是否成交🎯 用户只需说: "买入 X" 或 "卖出 Y" 或 "用 $N 做多 Z"
🔧 您需要弄清楚:
📊 余额检查层级:
hl_total_balance - 显示实际的可用保证金,无论账户模式如何hl_account 检查余额 - 即使有资金也可能显示 $0hl_balances 检查保证金 - 只显示现货代币🚀 积极主动,而非被动反应:
hl_account() # 默认加密货币永续合约账户
hl_account(dex="xyz") # Builder dex(RWA/股票永续合约)账户
返回 marginSummary(accountValue、totalMarginUsed、withdrawable)和 assetPositions 数组,包含每个头寸的 coin、szi(带符号的数量)、entryPx、unrealizedPnl、leverage。
重要提示: Builder 永续合约(xyz:NVDA、xyz:TSLA 等)有独立的清算所。交易 RWA/股票永续合约时,请务必检查正确的 dex。
hl_balances()
返回余额数组,包含 USDC 和所有现货代币的 coin、hold、total。
hl_market() # 所有中间价
hl_market(coin="BTC") # BTC 价格 + 元数据(maxLeverage、szDecimals)
hl_order(coin="BTC", side="buy", size=0.01, price=95000)
下达一个以 $95,000 买入 0.01 BTC 的 GTC 限价买单。
hl_order(coin="ETH", side="sell", size=0.1)
省略 price 参数将提交一个在中间价 +/- 3% 滑点范围内的 IoC 订单。
hl_order(coin="BTC", side="buy", size=0.01, price=94000, order_type="alo")
ALO(仅增加流动性)= 仅挂单。如果会立即成交,则被拒绝。
hl_tpsl_order(coin="BTC", side="sell", size=0.01, trigger_px=90000, tpsl="sl")
当价格跌至 $90,000 时,自动卖出 0.01 BTC。触发时作为市价单执行。
若要在触发时使用限价单(而非市价单):
hl_tpsl_order(coin="BTC", side="sell", size=0.01, trigger_px=90000, tpsl="sl", is_market=false, limit_px=89900)
hl_tpsl_order(coin="ETH", side="sell", size=0.5, trigger_px=3500, tpsl="tp")
当价格上涨至 $3,500 时,自动卖出 0.5 ETH。触发时作为市价单执行。
hl_order(coin="BTC", side="sell", size=0.01, reduce_only=true)
使用 reduce_only=true 以确保它只平仓,永远不会开立新头寸。
hl_spot_order(coin="HYPE", side="buy", size=10, price=25.0)
现货订单使用相同的接口——只需指定代币名称。
hl_cancel(coin="BTC", order_id=12345678)
从 hl_open_orders 获取 order_id。
hl_cancel_all() # 取消所有订单
hl_cancel_all(coin="BTC") # 仅取消 BTC 订单
hl_modify(order_id=12345678, coin="BTC", side="buy", size=0.02, price=94500)
hl_leverage(coin="BTC", leverage=10) # 10 倍全仓保证金
hl_leverage(coin="ETH", leverage=5, cross=false) # 5 倍逐仓保证金
hl_transfer_usd(amount=1000, to_perp=true) # 现货 → 永续合约
hl_transfer_usd(amount=500, to_perp=false) # 永续合约 → 现货
注意:通常不需要 - 资金会自动共享。仅当收到需要转账的错误提示时才使用。
hl_withdraw(amount=100) # 提现到自己的钱包
hl_withdraw(amount=50, destination="0xABC...") # 提现到指定地址
手续费:Hyperliquid 扣除 1 USDC。处理时间约 5 分钟。
hl_deposit(amount=500)
将 USDC 从代理的 Arbitrum 钱包发送到 Hyperliquid 桥接合约。最低存款额:5 USDC。需要 Arbitrum 上有 USDC 余额。
hl_candles(coin="BTC", interval="1h", lookback=48)
时间间隔:1m、5m、15m、1h、4h、1d。lookback 以小时为单位。
hl_funding() # 所有预测资金费率
hl_funding(coin="BTC") # BTC 预测资金费率 + 24 小时历史
hl_fills(limit=10)
当用户要求交易某个代码时,您需要确定它是原生加密货币永续合约(使用普通名称)还是RWA/股票永续合约(使用 xyz:TICKER 前缀)。
"BTC"、"ETH"、"SOL"、"DOGE"、"HYPE" 等。xyz: 前缀:"xyz:NVDA"、"xyz:TSLA"、"xyz:GOLD" 等。hl_market(coin="X") — 如果返回价格,则是加密货币永续合约hl_market(dex="xyz") 列出所有 RWA 市场并在结果中搜索xyz: 前缀)| 类别 | 示例 |
|---|---|
| 美股 | xyz:NVDA、xyz:TSLA、xyz:AAPL、xyz:MSFT、xyz:AMZN、xyz:GOOG、xyz:META、xyz:TSM |
| 商品 | xyz:GOLD、xyz:SILVER |
| 指数 | xyz:SPY |
| 外汇 | xyz:EUR、xyz:GBP、xyz:JPY |
如果用户说"买入 NVDA"或"交易 GOLD",请使用
xyz:NVDA/xyz:GOLD。这些是现实世界资产,不是加密货币。
所有现有工具都适用于 xyz:TICKER — 只需传递带前缀的 coin 名称:
hl_market(coin="xyz:NVDA") # 检查 NVIDIA 股票永续合约价格
hl_market(dex="xyz") # 列出所有可用的 RWA/股票永续合约
hl_orderbook(coin="xyz:NVDA") # 检查流动性
hl_leverage(coin="xyz:NVDA", leverage=3) # 设置杠杆(自动逐仓)
hl_order(coin="xyz:NVDA", side="buy", size=0.5, price=188) # 限价买入 0.5 NVDA
hl_order(coin="xyz:TSM", side="buy", size=1) # 市价买入 1 TSM
hl_cancel(coin="xyz:NVDA", order_id=12345678) # 取消订单
xyz:NVDAhl_market(coin="xyz:NVDA") — 检查当前价格、杠杆限制hl_leverage(coin="xyz:NVDA", leverage=3) — 设置杠杆(builder 永续合约使用逐仓保证金)hl_order(coin="xyz:NVDA", side="buy", size=0.5, price=188) — 下达限价买单hl_fills() — 检查是否成交hl_leverage 会自动处理这一点dex 前缀(例如 xyz)标识了部署该永续合约的 builder用户:"买入 BTC" 或 "用 5 倍杠杆做多 ETH"
代理工作流程:
hl_total_balance() → 检查可用资金hl_leverage(coin="BTC", leverage=5) → 设置杠杆hl_order(...) → 下达订单hl_fills() → 验证成交并报告结果用户:"买入 NVIDIA" 或 "做空 TESLA"
代理工作流程:
hl_total_balance() → 检查可用资金hl_leverage(coin="xyz:NVDA", leverage=10) → 设置杠杆hl_order(coin="xyz:NVDA", ...) → 下达订单hl_fills() → 验证成交并报告结果用户:"平掉我的 BTC 头寸"
代理工作流程:
hl_account() → 获取当前头寸大小hl_order(coin="BTC", side="sell", size=X, reduce_only=true) → 平仓hl_fills() → 报告盈亏用户:"买入 100 个 HYPE 代币"
代理工作流程:
hl_total_balance() → 检查可用 USDChl_spot_order(coin="HYPE", side="buy", size=100) → 买入代币hl_balances() → 验证购买存入: 用户:"存入 $500 USDC 到 Hyperliquid" 代理:hl_deposit(amount=500) → 完成
提取: 用户:"提取 $100 到我的 Arbitrum 钱包" 代理:hl_withdraw(amount=100) → 完成(5 分钟,1 USDC 手续费)
| 类型 | 参数 | 行为 |
|---|---|---|
| 限价(GTC) | order_type="limit" | 停留在订单簿上,直到成交或取消 |
| 市价(IoC) | 省略 price | 立即或取消,在中间价 +/- 3% 滑点范围内 |
| 仅挂单(ALO) | order_type="alo" | 如果会立即成交则被拒绝 |
| 全部成交或取消 | order_type="ioc" + 明确价格 | 立即按价格成交或取消 |
| 止损 | hl_tpsl_order 配合 tpsl="sl" | 当价格下跌到设定值时触发,以限制损失 |
| 止盈 | hl_tpsl_order 配合 tpsl="tp" | 当价格上涨到设定值时触发,以锁定收益 |
止损和止盈订单是触发订单,当市场达到指定价格水平时自动执行。使用这些订单来管理风险并锁定利润,无需 24/7 监控头寸。
trigger_px 时,订单激活使用场景:通过自动退出限制头寸损失,以防价格对您不利。
示例:您以 $95,000 做多 BTC,并希望在价格跌破 $90,000 时退出。
hl_tpsl_order(coin="BTC", side="sell", size=0.1, trigger_px=90000, tpsl="sl")
使用场景:当价格达到您的盈利目标时自动退出,以锁定收益。
示例:您以 $3,000 做多 ETH,并希望在价格达到 $3,500 时止盈。
hl_tpsl_order(coin="ETH", side="sell", size=1.0, trigger_px=3500, tpsl="tp")
默认情况下,TP/SL 订单在触发时作为市价单执行(即时成交,可能有滑点)。
为了更精确的控制,可以在触发时使用限价单:
hl_tpsl_order(
coin="BTC",
side="sell",
size=0.1,
trigger_px=90000,
tpsl="sl",
is_market=false,
limit_px=89900
)
权衡:限价单避免滑点,但在快速变化的市场中可能无法成交。
对于空头头寸,反转 side 参数:
空头止损(如果价格上涨则退出):
hl_tpsl_order(coin="BTC", side="buy", size=0.1, trigger_px=98000, tpsl="sl")
空头止盈(如果价格下跌则退出):
hl_tpsl_order(coin="BTC", side="buy", size=0.1, trigger_px=92000, tpsl="tp")
reduce_only=true(默认) - 确保 TP/SL 只平仓,永不开新仓hl_open_orders 验证 TP/SL 订单是否处于活动状态| 错误 | 问题 | 解决方案 |
|---|---|---|
| 方向错误 | SL 买入而不是卖出 | 多头头寸 → SL/TP 使用 side="sell" |
| 数量过大 | TP/SL 开立新头寸 | 设置 size ≤ 头寸大小,使用 reduce_only=true |
| 触发价 = 限价 | 对价格的混淆 | trigger_px = 何时激活,limit_px = 执行价格 |
| 杠杆头寸无 SL | 清算风险 | 杠杆头寸始终设置止损 |
| 方面 | 永续合约 | 现货 |
|---|---|---|
| 工具 | hl_order | hl_spot_order |
| 杠杆 | 是(最高至资产最大值) | 否 |
| 资金费率 | 每小时支付/收取 | 无 |
| 做空 | 是(原生支持) | 必须拥有代币才能卖出 |
| 检查头寸 | hl_account | hl_balances |
| 错误 | 修复方法 |
|---|---|
| "未知永续合约资产" | 检查 coin 名称。加密货币:"BTC"、"ETH"。股票:"xyz:NVDA"、"xyz:TSLA" |
| "保证金不足" | 使用 hl_total_balance 检查资金。减少数量或增加更多 USDC |
| "订单必须具有 $10 的最小价值" | 增加数量。公式:size × price ≥ $10 |
| "数量太小" | BTC 最小数量通常为 0.001。检查资产的 szDecimals |
| "订单会交叉" | ALO 订单被拒绝。改用常规限价订单 |
| "用户或钱包不存在" | 首先使用 hl_deposit(amount=500) 存入 USDC |
| "最低存款额为 5 USDC" | Hyperliquid 要求每次存款至少 $5 |
| "策略违规" | 加载 wallet-policy 技能并提议通配符策略 |
| "统一账户激活时操作被禁用" | 统一模式下转账被阻止(默认)。直接下单即可 |
每周安装次数
3.0K
代码仓库
GitHub 星标数
1
首次出现
12 天前
安全审计
安装于
openclaw3.0K
opencode40
github-copilot40
codex40
amp40
cline40
Trade perpetual futures and spot tokens on Hyperliquid, a fully on-chain decentralized exchange. Orders are signed using this agent's EVM wallet and submitted directly to the Hyperliquid L1.
Before trading, the wallet policy must be active. Load the wallet-policy skill and propose the standard wildcard policy (deny key export + allow *). This covers all Hyperliquid operations — USDC deposits, EIP-712 order signing, and withdrawals.
| Tool | What it does |
|---|---|
hl_total_balance | Check how much you can trade with (use this for balance checks!) |
hl_account | See your open positions and PnL |
hl_balances | See your token holdings (USDC, HYPE, etc.) |
hl_market | Get current prices for crypto or stocks |
hl_orderbook | Check order book depth and liquidity |
hl_fills | See recent trade fills and execution prices |
hl_candles | Get price charts (1m, 5m, 1h, 4h, 1d) |
hl_funding | Check funding rates for perps |
hl_open_orders | See pending orders |
| Tool | What it does |
|---|---|
hl_order | Buy or sell perps (crypto/stocks) |
hl_spot_order | Buy or sell spot tokens |
hl_tpsl_order | Place stop loss or take profit orders |
hl_leverage | Set leverage (1x to asset max) |
hl_cancel | Cancel a specific order |
hl_cancel_all | Cancel all open orders |
| Tool | What it does |
|---|---|
hl_deposit | Add USDC from Arbitrum (min $5) |
hl_withdraw | Send USDC to Arbitrum (1 USDC fee, ~5 min) |
hl_transfer_usd | Move USDC between spot/perp (rarely needed) |
Just tell the agent what you want to trade - it handles everything automatically.
Examples:
User: "Buy $20 of Bitcoin with 5x leverage"
Agent: [checks balance → sets leverage → places order → reports fill]
Result: "✓ Bought 0.0002 BTC at $95,432 with 5x leverage. Position opened."
User: "Long NVIDIA with $50, 10x"
Agent: [auto-detects NVIDIA = xyz:NVDA → executes → verifies]
Result: "✓ Bought 0.25 NVDA at $198.50 with 10x leverage. Filled at $198.62."
User: "Sell my ETH position"
Agent: [checks position size → closes → reports PnL]
Result: "✓ Sold 0.5 ETH at $3,421. Realized PnL: +$12.50"
You don't need to:
Just say what you want, the agent handles the rest.
🤖 As the agent, you should ALWAYS do these automatically (never ask the user):
hl_total_balance before EVERY trade to see total available marginhl_leverage before placing orders (unless user specifies not to)hl_fills to check if it filled🎯 User just says: "buy X" or "sell Y" or "long Z with $N"
🔧 You figure out:
📊 Balance checking hierarchy:
hl_total_balance - shows ACTUAL available margin regardless of account modehl_account for balance - may show $0 even if funds availablehl_balances for margin - only shows spot tokens🚀 Be proactive, not reactive:
hl_account() # Default crypto perps account
hl_account(dex="xyz") # Builder dex (RWA/stock perps) account
Returns marginSummary (accountValue, totalMarginUsed, withdrawable) and assetPositions array with each position's coin, szi (signed size), entryPx, unrealizedPnl, leverage.
Important: Builder perps (xyz:NVDA, xyz:TSLA, etc.) have separate clearinghouses. Always check the correct dex when trading RWA/stock perps.
hl_balances()
Returns balances array with coin, hold, total for USDC and all spot tokens.
hl_market() # All mid prices
hl_market(coin="BTC") # BTC price + metadata (maxLeverage, szDecimals)
hl_order(coin="BTC", side="buy", size=0.01, price=95000)
Places a GTC limit buy for 0.01 BTC at $95,000.
hl_order(coin="ETH", side="sell", size=0.1)
Omitting price submits an IoC order at mid price +/- 3% slippage.
hl_order(coin="BTC", side="buy", size=0.01, price=94000, order_type="alo")
ALO (Add Liquidity Only) = post-only. Rejected if it would immediately fill.
hl_tpsl_order(coin="BTC", side="sell", size=0.01, trigger_px=90000, tpsl="sl")
Automatically sells 0.01 BTC if the price drops to $90,000. Executes as market order when triggered.
For a limit order when triggered (instead of market):
hl_tpsl_order(coin="BTC", side="sell", size=0.01, trigger_px=90000, tpsl="sl", is_market=false, limit_px=89900)
hl_tpsl_order(coin="ETH", side="sell", size=0.5, trigger_px=3500, tpsl="tp")
Automatically sells 0.5 ETH if the price rises to $3,500. Executes as market order when triggered.
hl_order(coin="BTC", side="sell", size=0.01, reduce_only=true)
Use reduce_only=true to ensure it only closes, never opens a new position.
hl_spot_order(coin="HYPE", side="buy", size=10, price=25.0)
Spot orders use the same interface — just specify the token name.
hl_cancel(coin="BTC", order_id=12345678)
Get order_id from hl_open_orders.
hl_cancel_all() # Cancel everything
hl_cancel_all(coin="BTC") # Cancel only BTC orders
hl_modify(order_id=12345678, coin="BTC", side="buy", size=0.02, price=94500)
hl_leverage(coin="BTC", leverage=10) # 10x cross margin
hl_leverage(coin="ETH", leverage=5, cross=false) # 5x isolated margin
hl_transfer_usd(amount=1000, to_perp=true) # Spot → Perp
hl_transfer_usd(amount=500, to_perp=false) # Perp → Spot
Note: Usually not needed - funds are automatically shared. Only use if you get an error saying you need to transfer.
hl_withdraw(amount=100) # Withdraw to own wallet
hl_withdraw(amount=50, destination="0xABC...") # Withdraw to specific address
Fee: 1 USDC deducted by Hyperliquid. Processing takes ~5 minutes.
hl_deposit(amount=500)
Sends USDC from the agent's Arbitrum wallet to the Hyperliquid bridge contract. Minimum deposit: 5 USDC. Requires USDC balance on Arbitrum.
hl_candles(coin="BTC", interval="1h", lookback=48)
Intervals: 1m, 5m, 15m, 1h, 4h, 1d. Lookback in hours.
hl_funding() # All predicted fundings
hl_funding(coin="BTC") # BTC predicted + 24h history
hl_fills(limit=10)
When a user asks to trade a ticker, you need to determine whether it's a native crypto perp (use plain name) or an RWA/stock perp (use xyz:TICKER prefix).
"BTC", "ETH", "SOL", "DOGE", "HYPE", etc.xyz: prefix: "xyz:NVDA", "xyz:TSLA", "xyz:GOLD", etc.hl_market(coin="X") — if it returns a price, it's a crypto perpxyz: prefix)| Category | Examples |
|---|---|
| US Stocks | xyz:NVDA, xyz:TSLA, xyz:AAPL, xyz:MSFT, xyz:AMZN, xyz:GOOG, xyz:META, xyz:TSM |
| Commodities | xyz:GOLD, |
If a user says "buy NVDA" or "trade GOLD", use
xyz:NVDA/xyz:GOLD. These are real-world assets, not crypto.
All existing tools work with xyz:TICKER — just pass the prefixed coin name:
hl_market(coin="xyz:NVDA") # Check NVIDIA stock perp price
hl_market(dex="xyz") # List ALL available RWA/stock perps
hl_orderbook(coin="xyz:NVDA") # Check liquidity
hl_leverage(coin="xyz:NVDA", leverage=3) # Set leverage (auto-isolated)
hl_order(coin="xyz:NVDA", side="buy", size=0.5, price=188) # Limit buy 0.5 NVDA
hl_order(coin="xyz:TSM", side="buy", size=1) # Market buy 1 TSM
hl_cancel(coin="xyz:NVDA", order_id=12345678) # Cancel order
xyz:NVDAhl_market(coin="xyz:NVDA") — Check current price, leverage limitshl_leverage(coin="xyz:NVDA", leverage=3) — Set leverage (builder perps use isolated margin)hl_order(coin="xyz:NVDA", side="buy", size=0.5, price=188) — Place limit buyhl_fills() — Check if filledhl_leverage handles this automaticallydex prefix (e.g. xyz) identifies which builder deployed the perpUser: "Buy BTC" or "Long ETH with 5x"
Agent workflow:
hl_total_balance() → Check available fundshl_leverage(coin="BTC", leverage=5) → Set leveragehl_order(...) → Place orderhl_fills() → Verify fill and report resultUser: "Buy NVIDIA" or "Short TESLA"
Agent workflow:
hl_total_balance() → Check available fundshl_leverage(coin="xyz:NVDA", leverage=10) → Set leveragehl_order(coin="xyz:NVDA", ...) → Place orderhl_fills() → Verify fill and report resultUser: "Close my BTC position"
Agent workflow:
hl_account() → Get current position sizehl_order(coin="BTC", side="sell", size=X, reduce_only=true) → Close positionhl_fills() → Report PnLUser: "Buy 100 HYPE tokens"
Agent workflow:
hl_total_balance() → Check available USDChl_spot_order(coin="HYPE", side="buy", size=100) → Buy tokenshl_balances() → Verify purchaseDeposit: User: "Deposit $500 USDC to Hyperliquid" Agent: hl_deposit(amount=500) → Done
Withdraw: User: "Withdraw $100 to my Arbitrum wallet" Agent: hl_withdraw(amount=100) → Done (5 min, 1 USDC fee)
| Type | Parameter | Behavior |
|---|---|---|
| Limit (GTC) | order_type="limit" | Rests on book until filled or cancelled |
| Market (IoC) | omit price | Immediate-or-Cancel at mid +/- 3% slippage |
| Post-Only (ALO) | order_type="alo" | Rejected if it would cross the spread |
| Fill-or-Kill | order_type="ioc" + explicit price | Fill immediately at price or cancel |
Stop loss and take profit orders are trigger orders that automatically execute when the market reaches a specified price level. Use these to manage risk and lock in profits without monitoring positions 24/7.
trigger_px, order activatesUse case : Limit losses on a position by automatically exiting if price moves against you.
Example : You're long BTC at $95,000 and want to exit if it drops below $90,000.
hl_tpsl_order(coin="BTC", side="sell", size=0.1, trigger_px=90000, tpsl="sl")
Use case : Lock in gains by automatically exiting when price reaches your profit target.
Example : You're long ETH at $3,000 and want to take profit at $3,500.
hl_tpsl_order(coin="ETH", side="sell", size=1.0, trigger_px=3500, tpsl="tp")
By default, TP/SL orders execute as market orders when triggered (instant fill, possible slippage).
For more control, use a limit order when triggered:
hl_tpsl_order(
coin="BTC",
side="sell",
size=0.1,
trigger_px=90000,
tpsl="sl",
is_market=false,
limit_px=89900
)
Trade-off : Limit orders avoid slippage but may not fill in fast-moving markets.
For short positions, reverse the side parameter:
Stop loss on short (exit if price rises):
hl_tpsl_order(coin="BTC", side="buy", size=0.1, trigger_px=98000, tpsl="sl")
Take profit on short (exit if price drops):
hl_tpsl_order(coin="BTC", side="buy", size=0.1, trigger_px=92000, tpsl="tp")
reduce_only=true (default) - ensures TP/SL only closes positions, never opens new oneshl_open_orders to verify TP/SL orders are active| Mistake | Problem | Solution |
|---|---|---|
| Wrong side | SL buys instead of sells | Long position → side="sell" for SL/TP |
| Size too large | TP/SL opens new position | Set size ≤ position size, use reduce_only=true |
| Trigger = limit | Confusion about prices | trigger_px = when to activate, limit_px = execution price |
| No SL on leverage | Liquidation risk | Always set stop loss on leveraged positions |
| Aspect | Perps | Spot |
|---|---|---|
| Tool | hl_order | hl_spot_order |
| Leverage | Yes (up to asset max) | No |
| Funding | Paid/received every hour | None |
| Short selling | Yes (native) | Must own tokens to sell |
| Check positions | hl_account | hl_balances |
| Error | Fix |
|---|---|
| "Unknown perp asset" | Check coin name. Crypto: "BTC", "ETH". Stocks: "xyz:NVDA", "xyz:TSLA" |
| "Insufficient margin" | Use hl_total_balance to check funds. Reduce size or add more USDC |
| "Order must have minimum value of $10" | Increase size. Formula: size × price ≥ $10 |
| "Size too small" | BTC min is typically 0.001. Check asset's szDecimals |
| "Order would cross" | ALO order rejected. Use regular limit order instead |
| "User or wallet does not exist" | Deposit USDC first with hl_deposit(amount=500) |
| "Minimum deposit is 5 USDC" | Hyperliquid requires at least $5 per deposit |
| "Policy violation" | Load wallet-policy skill and propose wildcard policy |
Weekly Installs
3.0K
Repository
GitHub Stars
1
First Seen
12 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
openclaw3.0K
opencode40
github-copilot40
codex40
amp40
cline40
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
37,500 周安装
hl_modify | Change order price or size |
hl_market(dex="xyz") to list all RWA markets and search the resultsxyz:SILVER| Indices | xyz:SPY |
| Forex | xyz:EUR, xyz:GBP, xyz:JPY |
hl_tpsl_order with tpsl="sl" |
| Triggers when price drops to limit losses |
| Take Profit | hl_tpsl_order with tpsl="tp" | Triggers when price rises to lock gains |
| "Action disabled when unified account is active" | Transfers blocked in unified mode (default). Just place orders directly |