# Hyperliquid perps

> Trading Hyperliquid perpetual futures from your HyperEVM wallet, in plain words first, then the agent's full path from Base USDC to a position and back, what your rules enforce on each order, and when a registered signer is needed.
>
> Describes Orbit 0.1.9. Web page: https://docs.orbit.dialectic.com/0.1.9/using/hyperliquid-perps/

This page covers trading perpetual futures ("perps") on Hyperliquid from your wallet on HyperEVM, Hyperliquid's own network. The first part is in plain words; the rest is the agent's operating detail.

## In plain words

A perp is a bet on a price going up or down, made with borrowed exposure (leverage). Gains and losses can be several times larger than the money you put in, and if losses use up the margin, Hyperliquid closes the position.

How it works with Orbit:

1. Your agent moves USDC from your Base wallet to your wallet on HyperEVM (see [Bridging](https://docs.orbit.dialectic.com/0.1.9/using/bridging/)).
2. It deposits USDC from that wallet into **your wallet's own Hyperliquid trading account**. Nobody else holds that account; your wallet owns it.
3. It places and closes orders through your wallet's permissions. Every order that adds risk is checked against your rules first, including any leverage limit you signed.
4. To bring money back, it reverses the steps.

What you approve: the perps package and its markets when they are added to your wallet's permissions, your rules (including a leverage limit if you want one), and, only if you want leverage changes or automatic stop-loss and take-profit orders, registering a signer at Hyperliquid. Trading itself needs no signer.

Two things to know:

- **The leverage number Hyperliquid shows is not your limit.** It is the exchange's own margin setting. Your limit is the one in your rules.
- **Orbit's watchdog does not see the trading account.** It protects your HyperEVM wallet like any other, but a loss inside the Hyperliquid account is not seen until it shows up in your wallet's own accounting. Your rules' per-order checks, Hyperliquid's own margin rules and your agent's routines are what bound perp risk.

Learn more in Hyperliquid's docs: [HyperEVM](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm) and [margining](https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margining).

## For agents: operating perps

This part is for agents trading Hyperliquid perpetual futures from a HyperEVM Safe. It walks the whole path (bridge, deposit, order, protection, withdraw) and says exactly what Orbit enforces and what it does not. As of Orbit 0.1.9.

Live answers win: each tool's `in_words`, refusal text and `next` override this page. The `orbit-hyperliquid-perps` guide explains perps in plain words for the owner; this page is the operating detail.

## The two places money sits

| Place | What it is | Orbit reads it with |
|---|---|---|
| The HyperEVM Safe | A normal Safe on Hyperliquid's EVM network, holding tokens such as USDC and WHYPE | `get_balances`, `get_portfolio` |
| The Safe's Hyperliquid trading account (HyperCore) | The exchange account the Safe owns: perp margin and positions (perp DEX 0) plus a spot balance | `get_portfolio` → `core_accounts`, `list_known_positions` (`venue: "hypercore"`) |

Orders, cancels and transfers go from the Safe through the makinaX module to Hyperliquid's CoreWriter contract, the HyperEVM entry point for HyperCore actions ([interacting with HyperCore](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/interacting-with-hypercore)). Only Hyperliquid's native perp DEX is supported; builder-deployed perp DEXs are not.

## Preconditions

- A HyperEVM Safe configured in this Orbit (`list_safes`, `chain_id` 999), with the Hyperliquid perps package installed and its markets in the signed root. `get_perp_permissions` says which markets are active (`active.markets`); `search_perp_markets` finds markets and says whether one can be added later (`addable`), never that it is enabled.
- Signed limits. Under a US-dollar mandate, perps need the Hyperliquid package's USDC price (package 0.1.5 or later); until then the refusal says to update the package or approve the pending price setting.
- A leverage limit in the mandate if the owner wants one: `global.caps.max_perp_leverage`, or else `global.caps.max_group_leverage`, which then also covers perps. With neither, perps have no leverage limit.

## Step 1: bring USDC to the HyperEVM Safe

Bridge from the Base Safe with Circle CCTP. See [Bridging](https://docs.orbit.dialectic.com/0.1.9/using/bridging/) for the details.

Check the route first. It is read only, and an unavailable route comes back as an error, not `false`:

```json
{"tool": "get_setup_bridge_eligibility",
 "args": {"source_safe": "<base-safe>", "safe": "<hyperevm-safe>",
          "expected_source_chain_id": 8453, "expected_chain_id": 999}}
```

Then simulate the transfer:

```json
{"tool": "simulate_action",
 "args": {"safe": "<base-safe>",
          "call": {"kind": "bridge",
                   "order": {"bridge_id": 3, "dest_chain": "hyperevm",
                             "input_token": "USDC", "output_token": "USDC",
                             "amount": "100", "min_output": "100"}}}}
```

`amount` and `min_output` are token units here ("100" is 100 USDC), unlike the deposit in step 2. With `min_output` equal to `amount` the transfer is 1:1 and Orbit claims it on arrival. Then `execute_action`, and follow the transfer in `health_check` → `reliability.bridge_transfers` until it is claimed. Base to HyperEVM has no timing measurement: treat the arrival time as unknown ([Timing](https://docs.orbit.dialectic.com/0.1.9/using/bridging/#timing)).

## Step 2: move USDC into the trading account

The deposit is a harvest action from the package. Copy its id exactly from `list_actions`; the label after the last dot is the position's label and may contain spaces.

```json
{"tool": "list_actions", "args": {"safe": "<hyperevm-safe>", "protocol": "hyperliquid", "kind": "harvest"}}
```

```json
{"tool": "simulate_action",
 "args": {"safe": "<hyperevm-safe>", "backend": "fork",
          "call": {"kind": "harvest",
                   "action": "hyperliquid.deposit_usdc_for_perp.<label from list_actions>",
                   "params": {"usdc_amount": "100000000"}}}}
```

- `usdc_amount` is **base units, 6 decimals**: 100 USDC is `"100000000"`.
- Hyperliquid explains how value moves between the two sides in [HyperCore and HyperEVM transfers](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/hypercore-less-than-greater-than-hyperevm-transfers).
- It deposits into the perp account. The first deposit creates the Safe's Hyperliquid account.
- The deposit is a deployment: it counts against the per-transaction and daily limits.
- Orbit waits for HyperCore to record the transfer. While it is "still settling", perp increases are refused ("Your last transaction on Hyperliquid's network is still settling…"). Wait a moment and try again; closes and reductions are not affected.

## Step 3: place an order

Never hand-encode an order. `prepare_perp_order` turns the request into the package's exact call:

```json
{"tool": "prepare_perp_order",
 "args": {"safe": "<hyperevm-safe>", "market": "ETH", "side": "buy",
          "size_usd": "50", "order_type": "limit", "limit_price": "3000"}}
```

| Argument | Meaning |
|---|---|
| `market` | The coin (`"BTC"`, `"ETH"`) or the package's market label |
| `side` | `buy` or `sell`; omit and pass `close_position: true` to close |
| `size` or `size_usd` | Coins (`"0.015"`) or US dollars of notional (`"50"`); one of them |
| `order_type` | `limit` with `limit_price` (USDC), or `market` with `slippage_bps` |
| `slippage_bps` | Market orders only: the worst price accepted, in basis points from the current price (100 = 1%). Orbit picks none: ask the owner |
| `reduce_only` | Can only shrink a position |
| `tif` | `gtc`, `ioc` or `alo` |
| `close_position` | Reduce-only and immediate-or-cancel (IOC): fills what it can at once and cancels the rest; without a size it closes the whole position |
| `slot` | `0`, `1` or `2`; omit and Orbit picks a free one |

It reads the market, rounds size and price to the market's steps (never in your disfavour, and says so in `in_words`), and refuses an order that is too small (`below_minimum`, with the smallest size that clears it), unknown or mismatched. It sends nothing.

Then pass its `call` **unchanged**:

```json
{"tool": "simulate_action",
 "args": {"safe": "<hyperevm-safe>", "backend": "fork", "call": "<call from prepare_perp_order>"}}
```

Relay `in_words`, then `execute_action` with the same `call`, the `sim_receipt` and an `idempotency_key`.

- **Simulate on the fork backend.** Orbit must observe the CoreWriter action the transaction would place to check it against the mandate. Without that it refuses with `core_order_unverified` / `core_intent_not_captured`: nothing was sent. Relay the message and workaround text; never the technical field.
- **Minimum size.** An opening order under Hyperliquid's minimum notional is refused; `prepare_perp_order` states the minimum when it refuses. Reduce-only orders and closes are exempt.
- **Steps.** Size follows the market's size decimals; price allows 5 significant figures and limited decimals. Off-grid orders are refused because HyperCore would discard them silently.
- **One order per slot.** A prepared order reserves nothing. Send or drop it before preparing another on the same market. If an open order already holds the slot, prepare again for a free slot or cancel the open order.

### "Executed" means queued, not filled

A successful perp `execute_action` means the HyperEVM transaction succeeded and the order was **enqueued** on HyperCore. It does not mean it filled. Relay the result's `core_order.status_line`, then check the position (`get_portfolio` → `core_accounts`, or `list_known_positions`). Report Core success only from Orbit's Core result, never from the HyperEVM receipt.

### Cancelling

Cancels are package harvest actions (cancel by order id, or by the order's slot); `list_actions` shows them. The answer's `order.slot` from `prepare_perp_order` is what the package's cancel names. Cancels need no signer.

## What the mandate enforces on each order

Orbit re-checks every order at simulation and again at execution.

| Limit | How a perp order counts |
|---|---|
| Leverage (`max_perp_leverage`, else `max_group_leverage`) | On every order that **adds** risk: gross notional after the order (positions + resting non-reduce-only orders + this order, nothing netted) divided by the trading account's equity, unrealized PnL included. When the mandate governs more than one HyperEVM Safe, the other Safes' Hyperliquid accounts are read too and their margin and resting orders join the count. Closes and reductions are never refused by it |
| Per-transaction and daily deployment | The order's full notional (price × size). The deposit counts too |
| Position concentration (`max_position_concentration_pct`) | The margin that market posts after the order, at the exchange's leverage setting for it |
| Venue concentration (`max_protocol_concentration_pct`) | The margin of the whole trading account after the order, with resting orders on other markets counted at their full notional |
| Portfolio value used for limits | For a perp order, the total that limits divide by includes the trading account(s) at check time (not for the per-network share) |

When a leverage limit applies, Orbit refuses an increase instead of guessing when:

- **any** market on the account uses isolated margin ("A position on your Hyperliquid account uses isolated margin… so Orbit can't open or add to perp positions"). Switch it to cross, or close it;
- the account has no value left (`equity` ≤ 0);
- the account read is missing or stale;
- the account holds positions on another Hyperliquid perp DEX, which Orbit cannot value.

If the limits govern more than one HyperEVM Safe, Orbit also reads each other Safe's Hyperliquid account on every increase. An increase is refused, naming that Safe, if its last transfer is still settling, its account can't be read, it uses isolated margin, it holds positions on another Hyperliquid perp DEX, or it is worth less than zero.

Every leverage refusal ends "Nothing was sent. Closing or reducing positions is not affected."

### The exchange's leverage setting is not a permission

Hyperliquid shows a per-market leverage setting. It is the exchange's margin setting, not the owner's limit, and nothing in Orbit's policy reads it as a permission. The mandate's cap is enforced per order. `get_hyperliquid_account_settings` shows the two side by side; never present the exchange's number as the limit.

### Liquidation is the exchange's

Orbit does not model liquidation. If losses eat the margin below the maintenance level, Hyperliquid closes positions (see Hyperliquid's [margining](https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margining)); under cross margin that can take the whole trading account. Each position's `liquidation_price_usd` and `leverage` are in `get_portfolio` → `core_accounts`.

## The Hyperliquid signer

A Hyperliquid signer is a wallet registered at the exchange as an [API wallet](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets) for the Safe's account.

**You do not need one to trade.** Orders, closes and cancels go through the module and need no signer.

A registered signer is needed only for:

- **Account settings**: leverage, cross or isolated margin, isolated margin top-ups (`apply_hyperliquid_account_change`, or the owner-wallet pair `present_hyperliquid_account_action` / `submit_hyperliquid_account_signature`).
- **Stop-loss and take-profit** trigger orders (`protect_position`, `cancel_protection`; Hyperliquid package 0.1.6 or later).

### What a signer can do

A registered wallet acts at the exchange, **outside the mandate**: it can place and close trades and move funds into a trading pool someone else runs (a Hyperliquid vault). It cannot withdraw to another wallet. Say this plainly to the owner. Orbit's own code uses its signer only for leverage and margin changes and reduce-only stop-loss and take-profit orders.

### Registering

1. `get_hyperliquid_signer_status` with `safe`, `expected_safe`, `expected_chain_id`. Relay `summary`. `registered` is shown only when Hyperliquid lists the wallet.
2. If the package declared the signer step, it was approved with the setup batch: do not prepare a second batch. Orbit adds its signer once the first deposit arrives; if the status names `run_activation_steps`, call it.
3. Otherwise `prepare_hyperliquid_signer` with `safe`, `expected_safe`, `expected_chain_id` and `wallets` (the owner's choice; with Orbit's own operator wallet registered, later changes go through `apply_hyperliquid_account_change`). `wallets` accepts current owners of the Safe or Orbit's own operator wallet, which is registered under its reserved name; the field's schema text mentions owners only, but the operator is accepted. It builds an owner batch; show `consent_line`, get the owner's explicit yes, then hand the batch over (see [Approvals](https://docs.orbit.dialectic.com/0.1.9/concepts/approvals/)).
4. **It needs an existing trading account.** It is refused until the Safe's Hyperliquid account exists: deposit USDC first.

To remove Orbit's signer: `prepare_hyperliquid_signer_removal` with `safe`, `expected_safe`, `expected_chain_id` (one owner batch). When the signer step is in the Safe's permissions, the same batch also drops it from them, so the batch is a permissions update: relay `settings_review`, and after the owner executes it call `finalize_root_update`. The status says removed only once Hyperliquid no longer lists Orbit's wallet. To stop Orbit using it at once without removing it: `set_hyperliquid_agent_stopped` with `stopped: true`, or in a terminal `orbit-mcp hyperliquid-stop <safe>` (`--resume` to undo). Both say, and you must say, that the registration at Hyperliquid stays until removed.

If Orbit's signer is no longer registered at Hyperliquid, `protect_position` and the other protective-order tools answer `state: "signer_not_registered"`, and `apply_hyperliquid_account_change` answers `state: "kit_not_registered"`. Nothing was sent; their `next` names `prepare_hyperliquid_signer` and then `set_hyperliquid_agent_stopped`. A stop set on purpose is lifted with `set_hyperliquid_agent_stopped` (`stopped: false`).

### Changing leverage or margin with Orbit's signer

`apply_hyperliquid_account_change` with `safe`, `expected_safe`, `expected_chain_id` and `action`, a tagged object that is one of:

- `{"action": "set_leverage", "asset", "cross", "leverage"}`
- `{"action": "switch_to_isolated", "asset", "leverage"}`
- `{"action": "switch_to_cross", "asset", "leverage"}`
- `{"action": "add_isolated_margin", "asset", "usdc"}`
- `{"action": "remove_isolated_margin", "asset", "usdc"}`

`asset` is the coin symbol (`"ETH"`, as in `prepare_perp_order`'s `market`) or the Hyperliquid asset index (`get_hyperliquid_account_settings` → `rows[].asset`). `leverage` is a whole multiplier.

1. Call it first **without** `confirmation_id`. Show the headline, setting row and consequence sentence word for word.
2. A change that only lowers risk goes through on this call; relay what it did.
3. A change that raises risk (leverage up, switching to isolated, moving isolated margin) needs the owner's explicit yes, then a second call with the `confirmation_id` that card returned. An id is spent on use and binds the exact change.
4. `state: "confirmed"` means Orbit read the new setting back; `submitted` means sent but not confirmed.

Switching any market to isolated makes Orbit refuse every perp increase while a leverage limit applies. Lowering cross leverage keeps orders allowed.

### Stop-loss and take-profit

`protect_position` with `safe`, `expected_safe`, `expected_chain_id`, the market and `stop_loss_price` and/or `take_profit_price` (never a size: side and size come from the live position). Show `in_words` verbatim, then call again with the same arguments and the returned `preview_id`. `changed` means preview again; `unconfirmed` or `partly_placed` means check open orders before placing again.

A stop-loss sells at market within an allowance (`stop_market_slippage_bps`, basis points of the trigger price). Orbit picks none itself. The order of precedence is: the value on the `protect_position` call, then the owner's setting (`set_stop_loss_slippage`, recorded on their word), then the package's suggested `market_slippage_bps` (or the package's default for markets it doesn't list). With none of these, the stop-loss is a limit at its trigger and may not fill in a fast move. `get_stop_loss_slippage` shows how a stop-loss exits now and where its allowance comes from. `cancel_protection` also takes `safe`, `expected_safe`, `expected_chain_id`.

**Without a signer** there is no stop that triggers on a falling price. A resting reduce-only GTC limit order at a target price (`prepare_perp_order` with `reduce_only: true`, `order_type: "limit"`) works as a take-profit. To limit a loss, close or reduce the position in a routine.

## Funding, PnL and value

- **How funding works:** Hyperliquid pays funding every hour between longs and shorts. When the rate is positive, longs pay shorts; when it is negative, shorts pay longs. It can cost or earn money for as long as a position is open.
- **Market research:** `get_perp_market_data` with the markets gives mark, oracle and mid price, funding now, annualised and the predicted next rate, open interest, 24 h volume and max leverage. `history_hours` adds recent funding payments (up to a fixed cap) and candles. Values are indicative; Orbit's limits never use them.
- **The account:** `get_portfolio` → `core_accounts`. Per position: `notional_usd`, `entry_price_usd`, `mark_price_usd`, `unrealized_pnl_usd`, `liquidation_price_usd`, `leverage`, `margin_used_usd`, `funding_paid_usd`. Per account: `reported_equity_usd`, `withdrawable_usd`, `margin_used_usd`, `gross_notional_usd`, `account_leverage`, `funding_paid_usd`.
- `funding_paid_usd` is Hyperliquid's all-time cumulative funding for each coin on the account, passed through; Orbit describes positive as paid. The account figure sums only coins held now.
- **Value:** a perp position's size and notional are exposure, never value. Only the trading account's equity counts. `nav.amount` on a HyperEVM Safe includes it; `nav.conservative` in `get_portfolio` is the on-chain figure and leaves Hyperliquid out. A perp order's own limit check adds the trading account (see the table above).
- `health_check` shows no perp fields.

## Bringing money back

1. Margin held by open positions cannot be withdrawn. Close or reduce positions first so the USDC is withdrawable.
2. Move USDC from the perp account to the spot balance: the package's `transfer_usdc_perp_to_spot` harvest action, param `transfer_amount` in **6 decimals** (10 USDC is `"10000000"`).
3. Withdraw from the **spot** balance to the Safe: `withdraw_usdc_to_evm`, whose amount is in HyperCore's **8-decimal** USDC units (10 USDC is `"1000000000"`). From hyperliquid-perps 0.1.9 the slot is named `withdraw_amount_core_usdc`; older versions call it `withdraw_amount_wei`, with the same 8-decimal unit. Read the name from `list_actions`.
4. Relay Orbit's withdraw preflight notes as they stand: they say when the trading account has no HYPE for gas or when the whole balance moves. Hyperliquid makes the final call. If HYPE is needed and the package lists `buy_spot`, the agent can buy a little HYPE itself ([Buying HYPE with USDC](#buying-hype-with-usdc)); the `core_hype_missing` refusal's `next` and `health_check` (per Safe `gas_status`, its `safe_core_hype` row) name that action. Otherwise `prepare_core_hype_top_up` (an owner batch; see [Funding and gas](https://docs.orbit.dialectic.com/0.1.9/using/funding-and-gas/#core-hype-on-hyperevm)).
5. Bridge back to Base with CCTP if needed.

The 100x trap: the perp-to-spot transfer is 6 decimals and the withdraw is 8 decimals. Copying the same number between them moves 1/100 or 100 times the amount you meant.


HYPE is the only spot asset Orbit trades on Hyperliquid, through the package's HYPE sale and HYPE buy below.

## Selling HYPE for USDC

HYPE in the trading account's spot balance can be sold for USDC only through the package's HYPE/USDC spot sale, when the installed package version includes it (newer versions of the Hyperliquid perps package do; it needs Orbit 0.1.8-rc.3 or later, the stable 0.1.8 included). Look for the `sell_spot` harvest action in `list_actions`; without it there is no way to sell spot HYPE through Orbit.

- **The lowest price is the owner's.** Ask for it; never choose one. Pass `params`: `limit_px`, that lowest price per HYPE in USDC with 6 decimals, and `sz`, the HYPE amount with 2 decimals. Read the slot names from `list_actions`.
- **What it does.** It only sells, immediately, at the lowest price or better, as far as the market fills; the rest is cancelled. It never buys, never leaves an order resting, and has no leverage, stop-loss or take-profit. It needs no signer.
- **Before it is sent.** `simulate_action` returns `in_words` describing the sale; show it, then `execute_action`. Orbit refuses a price with more significant figures than Hyperliquid allows, or a size or price off the market's grid, and nothing is sent.
- **Afterwards.** The USDC lands in the spot balance; bring it back to the Safe the usual way (above).

The manifest rules for this action are on [Packages for curators](https://docs.orbit.dialectic.com/0.1.9/contributing/packages-for-curators/#hyperliquid-spot-sale).

## Buying HYPE with USDC

USDC in the trading account's spot balance can buy HYPE through the package's HYPE/USDC spot buy, when the installed package version includes it (Hyperliquid perps 0.1.15 or later; it needs Orbit 0.1.8-rc.7 or later, the stable 0.1.8 included). Look for the `buy_spot` harvest action in `list_actions`. Its usual purpose is the HYPE a withdraw from Hyperliquid to HyperEVM needs on the spot account.

- **Inputs.** `params`: `limit_px`, the highest price per HYPE in USDC, and `sz`, the HYPE amount, in the same units as the sale. Read the slot names from `list_actions`.
- **What it does.** It only buys, immediately, at the highest price or better, as far as the market fills; the rest is cancelled. It never sells, never leaves an order resting, and has no leverage. It needs no signer.
- **What bounds it.** Orbit refuses a highest price above the package's price allowance over Hyperliquid's current HYPE price, a price more precise than Hyperliquid allows, an order below Hyperliquid's minimum order value, a price or size off the market's grid, and an order the spot USDC cannot pay; nothing is sent, and the refusal says what was wrong. A buy adds a HYPE position, so the mandate treats it as an increase: its value and concentration limits apply. It has no leverage, so the leverage limit does not.
- **Before and after.** `simulate_action` returns `in_words` describing the purchase; show it, then `execute_action`. The buy counts as done only once the HYPE shows on the spot balance.

The manifest rules for this action are on [Packages for curators](https://docs.orbit.dialectic.com/0.1.9/contributing/packages-for-curators/#hyperliquid-spot-buy).

## Hedging with a position on another Safe

A perp can offset price risk held elsewhere, for example a token on the Base Safe against a short perp on the HyperEVM Safe. Orbit has no notion of a hedge:

- The two legs are separate actions on separate Safes, each checked on its own. The limits do not net them: leverage counts gross perp notional, concentration counts posted margin, and per-transaction and daily limits count each leg in full.
- Whether a spot leg on an EVM Safe can run is `get_swap_quote` → `executable`. Swaps never appear in `list_actions`.
- On Hyperliquid itself the only spot trades are the HYPE sale and buy above.


## What does not watch Hyperliquid

The watchdog follows each Safe's module events on every configured network, HyperEVM included, estimates losses from oracle-priced value changes, and pauses the module with the guardian key when its check trips. It reads no HyperCore perp positions, Core balances or CoreWriter state, so it will not pause on perp losses: a loss inside the trading account is not seen until it shows up in the module's accounting. Perp risk is bounded by the mandate's per-order checks, the exchange's own margin rules, and the agent's routines.

## Common refusals

| Refusal | Meaning | What to do |
|---|---|---|
| `below_minimum` | Opening order under Hyperliquid's minimum notional (the refusal states it) | Use the smallest size it names, or more |
| Still settling | The last HyperCore transfer is not recorded yet | Wait, try again |
| Isolated margin | A market on the account is isolated | Switch it to cross, or close it |
| Leverage limit | Gross ÷ equity would exceed the cap | Smaller order, or reduce first |
| `core_order_unverified` | Orbit could not observe the Core order in simulation | Simulate with `backend: "fork"`; relay the message and workaround |
| `slot_in_use` | The slot you named is held by an open order | Cancel the open order, or prepare for another slot |
| `slots_full` | No free slot on that market | Cancel an open order first |
| `no_slippage` | A market order without `slippage_bps` | Ask the owner for slippage; never pick one |
| `two_sizes` / `mixed_order_type` | Both `size` and `size_usd`, or a slippage on a limit order (or a price on a market order) | Pass one size and one order type |
| `larger_than_position` | A reduce or close larger than the position | Use the position's size, or `close_position: true` |
| `market_mismatch` | The package and Hyperliquid describe the market differently right now | Relay the message; nothing was prepared |
| `not_allowed` | The Safe's permissions have no place or close action for that market | Check `get_perp_permissions`; adding it is a permission update |
| Highest price above the allowance (`buy_spot`) | The price is further above Hyperliquid's HYPE price than the package allows | Choose a highest price closer to the current price |
| Below the minimum order value (`buy_spot`) | Size × highest price is under Hyperliquid's minimum (the refusal states it and the smallest size) | Buy at least the size it names |
| `wrong_chain` | The Safe is not on HyperEVM | Use the HyperEVM Safe (`list_safes`) |
| Other perp DEX | The account (or another governed HyperEVM Safe's account) holds positions on another Hyperliquid perp DEX | Close those positions; closes here are not affected |
| `market_not_covered` (`protect_position`) | The market is not in the Safe's permissions | Add the market with a permission update |
| `signer_removal_pending` | A removal of Orbit's signer awaits the owner | Only on the owner's word, `discard_prepared_removal: true` |
| USD price missing | The package's USDC price is not in place | Update the package or approve the pending price setting |

## Pitfalls seen in real agents

- Treating the exchange's leverage setting as permission to use that leverage. The mandate's cap is the limit.
- Believing a signer is needed to trade. It is needed only for leverage/margin and stop-loss/take-profit.
- Calling `prepare_hyperliquid_signer` before any deposit. The trading account must exist first.
- Reporting an order as filled because `execute_action` succeeded. It was queued.
- Setting one market to isolated margin and then finding every increase refused.
- Looking for funding in `health_check`. It is in `get_portfolio` → `core_accounts`.
- Mixing up the 6-decimal and 8-decimal withdraw steps.
