Skip to main content
The hyperliquid tool covers perps, spot, HIP-3 markets and HIP-4 outcome markets on Hyperliquid. It is one tool with an action parameter, and you pass only the parameters that action lists. For what the venue is and how funding works, read Hyperliquid first. Every action needs authentication; see Authentication. A call looks like this:

Actions

Actions marked write place orders, move funds or change account settings. Show the user a summary and get a yes before calling them. Every trade needs the user’s confirmation, and nothing here is financial advice.

Market data

Account

Orders

TWAP, leverage and funds

Outcomes (HIP-4)

User-scoped reads such as get_account_summary, get_open_orders and get_user_fills accept an optional address. Set it to read another wallet; leave it out for the caller’s own data. get_deposit_address always returns the caller’s address.

Request-shape rules

Order requests use Hyperliquid’s single-letter field names. The readable names you see in responses (coin, is_buy, sz, limit_px) are rejected on the request side and produce a confusing server error.
A correct place_order call:
Here is what each field in an order means: grouping is na by default, normalTpsl to group a take-profit and stop-loss with an entry, or positionTpsl to attach them to an existing position.

Asset index

Compute a from get_market_metas. Do not guess it. update_leverage, update_isolated_margin, cancel_order and place_twap_order take the same numeric index. A symbol such as xyz:NVDA fails there.
The HIP-4 offset is one hundred million: a 1 followed by eight zeros. It is easy to miscount.

Outcome shares

  • An outcome share’s encoding is 10 * outcome + side. Its spot coin is # followed by the encoding.
  • Side 0 is the first entry in the outcome’s sideSpecs and side 1 is the second. On a standard Yes or No market, Yes is side 0. Use the names in sideSpecs when you show a market.
  • Sizes are whole shares.
  • Collateral is USDC. No other token is needed.
  • Recurring markets reuse the same display name. Build the label from the parsed metadata (underlying, target or thresholds, expiry) and not from name.

Tips

  • Read the balance as one number. Add the perp withdrawable amount and the spot USDC total from get_account_summary, and report a single USDC balance.
  • Check the account mode once. If the mode is default or disabled and there is perp USDC, call set_user_abstraction with abstraction: 'u', then tell the user it was done.
  • Pick the time-in-force by intent. Ioc for “buy now”, Gtc only when the user names a price, Alo for post-only, FrontendMarket for HIP-3 stock perps.
  • Convert dollars to size yourself. Divide the dollar amount by the mid price and round to szDecimals.
  • Relay collateral errors as given. An insufficient-funds rejection names the asset the market needs. A few HIP-3 dexes use USDH; get it by buying USDH with USDC on Hyperliquid spot.
  • t on a TWAP is different. On place_twap_order, t is a true or false flag for randomized timing and m is the duration in minutes.

Next

Hyperliquid

Funding, order types and limits in plain words.

Hyperliquid outcomes

How outcome markets work.