Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Trading

Your agent can trade on-chain and on Hyperliquid directly from the CLI with a single command — acp trade. Funded by the agent wallet and signed by its keystore-backed signer, trading is a first-class agent skill: swap tokens across chains (including in and out of Solana), deposit to Hyperliquid, open leveraged perp positions — on crypto, stocks, currencies, and commodities — and buy or sell tokenized stocks spot, all without the agent ever holding a raw private key.

How it works

The CLI stays a thin signer. The ACP backend plans each route (forwarding to the routing service, which auto-selects the best route for swaps); the CLI auto-signs and broadcasts every leg with the keystore signer. Hyperliquid orders and withdrawals are EIP-712 actions signed by the same key. Private keys never leave the OS keystore.

Routing is driven entirely by --chain-in / --chain-out:

chain-inchain-outAction
EVM → EVMSwap — same-chain or cross-chain
EVM → 1337Deposit USDC into Hyperliquid
13371337Hyperliquid spot order (USDC-quoted)
1337 → EVMWithdraw USDC from Hyperliquid
Solana → EVMSwap out of Solana (e.g. USDC@sol → an EVM token)

Two intents don't use the chain-pair shape:

  • Perps--side long\|short (with --token).
  • Tokenized stocks (spot)--token <TICKER> with --amount-usdc (buy) or --amount-shares (sell), and no --side. The backend auto-picks the venue and chain.

Hyperliquid spot is the order-book route (13371337) and is different from tokenized-stock spot.

Prerequisites

  • An active agent with a signeracp agent add-signer (trading signs on-chain; it refuses without one).
  • Funds in the agent wallet — USDC for swaps/deposits, plus gas on the source chain. Top up with acp wallet topup.
  • Just your normal acp configure auth — swaps and deposits run through the ACP backend, no extra env vars.

Swap

Same-chain or cross-chain. The ACP backend plans the route; the CLI signs each leg.

# Same-chain swap on Base: USDC → VIRTUAL
acp trade --token-in usdc --chain-in 8453 --amount-in 50 --token-out virtual --chain-out 8453
 
# Cross-chain swap: USDC on Ethereum → USDC on Base
acp trade --token-in usdc --chain-in 1 --amount-in 100 --token-out usdc --chain-out 8453

Cross-chain swaps block until the bridge settles — the CLI signs the source-chain tx, then polls the bridge every 10s (typically ~10–30s, with a 10-minute cap for slower routes). Treat them as long-running and let the command return.

Hyperliquid

Deposit

Move USDC into Hyperliquid (chain 1337). Deposits land in the perp wallet.

acp trade --token-in usdc --chain-in 8453 --amount-in 25 --token-out usdc --chain-out 1337

Spot

Hyperliquid spot trades on the HL order book and uses chain 1337 on both sides. A buy spends USDC (--token-in usdc) and a sell returns USDC (--token-out usdc):

# Buy PURR on the Hyperliquid spot order book with 100 USDC
acp trade --token-in usdc --chain-in 1337 --amount-in 100 --token-out PURR --chain-out 1337
 
# Sell 50 PURR back to USDC
acp trade --token-in PURR --chain-in 1337 --amount-in 50 --token-out usdc --chain-out 1337

Perps

Leveraged positions use --side, --token, --size, and optional --leverage. Hyperliquid's perp markets span far more than crypto — your agent can take leveraged positions on stocks/equities, currencies/FX, and commodities as well, all through the same flags. Just pass the Hyperliquid market symbol as --token:

# Market long 0.01 BTC at 5x leverage (crypto)
acp trade --side long --token BTC --size 0.01 --leverage 5
 
# Same shape for an equity, FX, or commodity perp — only the symbol changes
acp trade --side long --token <HL_MARKET_SYMBOL> --size 1 --leverage 3

Hyperliquid keeps perp (collateral) and spot USDC in separate wallets. The CLI auto-balances before an order — moving any shortfall between wallets via an instant, free L1 transfer — so deposit → trade just works, with no manual transfer step. HL enforces a ~$10 minimum order value.

Status & withdraw

# HL ACCOUNT status ONLY — HL perp positions, margin, and HL spot balances.
# For on-chain token balances on any EVM chain, use `acp wallet balance` instead.
acp trade hl-status
 
# Withdraw USDC off Hyperliquid (settles to Arbitrum; --to-chain bridges onward)
acp trade withdraw-from-hl --amount 25

Tokenized stocks (spot)

Buy or sell real tokenized equities — you receive the share token, with no leverage and no Hyperliquid funding. This is tokenized-stock spot, distinct from both Hyperliquid spot and an HL equity perp. The backend auto-routes the venue and chain.

# Buy $5 of AAPL with USDC you already hold
acp trade --token AAPL --amount-usdc 5
 
# Buy funded from another chain — bridges VIRTUAL@Base → USDC, then buys
acp trade --token AAPL --token-in virtual --chain-in 8453 --amount-in 8
 
# Sell 0.01 AAPL shares (delivers USDC; --chain is required on sells)
acp trade --token AAPL --amount-shares 0.01 --chain sol

A buy can spend USDC you already hold or be funded from another chain (it bridges first); sells need an explicit --chain eth|sol because the server can't see which chain holds your shares.

Discover what's tradable

acp trade stock-list is a read-only discovery command — no signing, no funds moved.

# No symbol → the spot markets: tokenized stocks + the HL spot order book
acp trade stock-list --json
 
# A symbol → every route for one asset, each naming the exact ticker to pass
acp trade stock-list AAPL --json

With no symbol you get { stocks, hlSpot } (the tokenized-stock catalog and the HL spot order book). With a symbol you get { symbol, name?, routes }, where each route's token is the exact ticker to pass — an HL equity perp must be quoted xyz:AAPL, while spot routes use bare AAPL. Resolve the ticker here, then build the trade with the flags above.

Supported chains

Base (8453), Ethereum (1), BSC (56), Hyperliquid (1337), Solana, and Base Sepolia (testnet).

For the full flag matrix, run acp trade --help (or acp skill print). See also the CLI command reference.