> For the complete documentation index, see [llms.txt](/llms.txt).

# Trade perpetuals

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

## Ask your agent[​](#ask-your-agent "Direct link to 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[​](#prerequisites "Direct link to Prerequisites")

- [Quickstart](/agent-wallet/quickstart/) completed
- USDC on a supported source chain for the initial deposit

## First-time setup[​](#first-time-setup "Direct link to 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[​](#open-a-position "Direct link to 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[​](#close-or-modify-a-position "Direct link to Close or modify a position")

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

```

## Common pitfalls[​](#common-pitfalls "Direct link to 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.

## Related commands[​](#related-commands "Direct link to Related commands")

See [mm perps](/agent-wallet/reference/commands/#mm-perps) in the commands reference.
