For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Trade perpetuals

Open, modify, and close perpetual positions on Hyperliquid through the mm perps commands.

Ask your agent

You (to your agent): "Open a 5x long on BTC with $100 on Hyperliquid"
You (to your agent): "Close my BTC perp position on Hyperliquid"

Your agent deposits if needed, fetches a quote, confirms details with you, then executes.

Prerequisites

  • Quickstart completed
  • USDC on a supported source chain for the initial deposit

First-time setup

  1. List venues:

    mm perps list-venues
  2. Deposit USDC into the venue before your first trade:

    mm perps deposit --venue hyperliquid --amount <AMOUNT>
  3. Confirm your perpetuals balance:

    mm perps balance --venue hyperliquid

Open a position

  1. List markets:

    mm perps markets --venue hyperliquid
  2. Get a quote:

    mm perps quote --venue hyperliquid --symbol <SYMBOL> --side long --size <SIZE> --leverage <N>
  3. Open the position:

    mm perps open --venue hyperliquid --symbol <SYMBOL> --side long --size <SIZE> --leverage <N>

    Add --dry-run to preview without submitting. Add --yes to skip interactive confirmation in scripted flows.

Close or modify a position

mm perps close --venue hyperliquid --symbol <SYMBOL>
mm perps modify --venue hyperliquid --symbol <SYMBOL> --leverage <N>

Common pitfalls

Deposit before you trade

The Hyperliquid sub-account is empty on first use. Running mm perps open before depositing can fail with HYPERLIQUID_ERROR or ORDER_REJECTED. mm perps deposit sources USDC from Arbitrum by default. Deposit with mm perps deposit --venue hyperliquid --amount <N> before opening your first position.

See mm perps in the commands reference.