Skip to main content
Perpetual Trading lets users trade perpetual futures on stocks (AAPL, TSLA, NVDA), commodities (GOLD, SILVER, CL) and forex (EUR, GBP, JPY), with leverage, on Hyperliquid. Users deposit USDC from Arbitrum, and every trade is a signed message: no gas and no on-chain transaction per order. Unlike the other products, Perpetual Trading doesn’t use a product account. Orders run from the user’s own Hyperliquid account, keyed by their wallet address. Positions are contracts that track a price, not tokens the user holds. For real on-chain tokens, see Tokenized Assets.

How every action works

  1. Prepare. Call the endpoint for the action: an order, a leverage change, a withdrawal. It returns typed_data, action and nonce.
  2. Sign. The user signs typed_data as EIP-712 typed data in their wallet. Nothing is broadcast.
  3. Execute. Send action, nonce and the signature to POST /v2/perpetual_trading/execute. Compass forwards it to Hyperliquid and returns the result.

Before you start

  • An API key. See the Quick Start.
  • An Arbitrum wallet of your own, holding ETH for gas. Deposits go through Hyperliquid’s bridge on Arbitrum, and your wallet sends that transaction. Keep its key on your server.

1. Deposit USDC

The user signs a USDC permit, and your wallet sends the bridge transaction on Arbitrum.
1

Get the permit

2

Send the bridge transaction

Pass the user’s signature to POST /v2/perpetual_trading/deposit/sponsor_prepare:
The response is a transaction for your sponsor wallet to sign and send on Arbitrum. Hyperliquid credits the user’s account once it confirms. Check withdrawable on the positions endpoint before showing the deposit as complete.

2. One-time setup per user

  • Account mode. Call POST /v2/perpetual_trading/enable_unified_account. If typed_data is null, there’s nothing to do. Otherwise the user signs it and you execute it.
  • Leverage. Call POST /v2/perpetual_trading/set_leverage with asset and leverage before the first order on each asset. Leave out leverage to use the market’s maximum. If leverage_ok is true, there’s nothing to sign. Leverage stays set per asset until you change it.
  • Your fee. If you charge a fee, the user approves your builder address once. See Charge a fee.

3. Place an order

Buy 1 AAPL contract at market, then execute the signed action:
For a limit order, call POST /v2/perpetual_trading/limit_order with a price and time_in_force (gtc or alo), and cancel it with POST /v2/perpetual_trading/cancel_order. Both follow the same sign-and-execute steps.

4. Track positions

Each open position has side, size, entry_price, mark_price, liquidation_price, leverage, unrealized_pnl and funding_accrued. The response also carries account_value and withdrawable, the USDC the user can take out. For fills and open orders as well, use GET /v2/perpetual_trading/activity. For price charts, use GET /v2/perpetual_trading/candles.

5. Withdraw

Call POST /v2/perpetual_trading/withdraw with owner and amount, and optionally a destination on Arbitrum. The user signs and you execute it. The USDC arrives on Arbitrum once Hyperliquid processes the withdrawal, which takes from minutes to a few hours.

Charge a fee

Hyperliquid lets you add a builder fee to your users’ fills. It’s charged on top of Hyperliquid’s own fee and credited in USDC to an address you control.
  1. Approve once per user. Call POST /v2/perpetual_trading/approve_builder_fee with builder: {"address": "0xYourBuilderAddress", "max_fee_rate": "0.01%"}. The user signs and you execute it. To raise the rate later, approve again. Lowering it needs no new approval.
  2. Add builder to each order. Pass the same address and a max_fee_rate at or below what the user approved. Orders without builder pay no fee.
  3. Read what you earned. Each fill in activity carries its builder_fee, and builder_approval shows the user’s current approval when you pass your builder address.
The rate is at most 0.1%, in steps of 0.001%. The builder address must be a regular wallet holding at least 100 USDC in its Hyperliquid perps account before the first approval; otherwise execute returns 502 Builder has insufficient balance to be approved. Fees accumulate in that address’s Hyperliquid account under the xyz DEX, separate from its main perps balance. Your users, their fills and their approval state also appear on the Hyperliquid tab of your dashboard.

Good to know

  • Higher leverage means a closer liquidation price. Hyperliquid checks leverage when a position opens. Watching liquidation_price and margin afterwards is up to you.
  • Markets. GET /v2/perpetual_trading/opportunities lists every market with mark_price, funding_rate, max_leverage, open interest and volume. Filter by category: stock, commodity or forex.
  • Funding. Positions pay or receive funding every hour. It shows per position as funding_accrued.
  • Rejected actions. execute returns status: "error" with Hyperliquid’s message, for example when margin is insufficient. Show it to the user.

Endpoints

Next

Tokenized Assets

Real tokenized stocks and RWAs, held as ERC-20s.

Crypto-Backed Loans

Borrow USDC against crypto to fund trading.

Bridging

Move USDC to Arbitrum from another chain.