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.
Prerequisites
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.
Available Tools
Account & Market Info
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
Trading
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
hl_modify
Change order price or size
Funds
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)
Quick Start
Just tell the agent what you want to trade - it handles everything automatically.
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.
How They Work
Order Placement
Place a dormant trigger order with a trigger price
Monitoring
Order sits inactive, watching the market price
Trigger
When market price reaches
trigger_px
, order activates
Execution
Order executes immediately (as market or limit order)
Stop Loss (SL)
Use 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.
Executes as market order when triggered (instant exit)
Market vs Limit Execution
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
)
trigger_px=90000
Activates at $90k
is_market=false
Use limit order (not market)
limit_px=89900
Limit price when triggered ($89,900)
Trade-off
Limit orders avoid slippage but may not fill in fast-moving markets.
Short Positions
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")
Best Practices
Always use
reduce_only=true
(default) - ensures TP/SL only closes positions, never opens new ones
Match size to position
- TP/SL size should equal or be less than your position size
Set both TP and SL
- protect both upside (take profit) and downside (stop loss)
Account for volatility
- don't set stops too tight or they'll trigger on normal price swings
Check open orders
- use
hl_open_orders
to verify TP/SL orders are active
Common Mistakes
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
Perps vs Spot
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
Risk Management
Always check account state before trading
— know your margin usage and existing positions
Set leverage explicitly
before opening new positions (default may vary)
Use reduce_only
when closing to avoid accidentally opening the opposite direction
Monitor funding rates
— high positive funding means longs are expensive to hold
Start with small sizes
— Hyperliquid has minimum order sizes per asset (check szDecimals)
Post-only (ALO) orders
save on fees (maker vs taker rates)
Check fills after market orders
— IoC orders may partially fill or not fill at all
Common Errors
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
"Action disabled when unified account is active"
Transfers blocked in unified mode (default). Just place orders directly