> ## Documentation Index
> Fetch the complete documentation index at: https://public-perps-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Trading

> Trading actions and available markets on Hyperliquid

The Hyperliquid provider exposes trading operations in the `actions` array from `GET /providers`. Each action lists which signers can execute it.

For account setup actions (the provider's `setup` array) and post-setup options (`options`), see [Setup](/providers/hyperliquid/setup). For full parameter schemas, see the [Actions API reference](/api-reference/actions).

## `actions`

These are returned in the `actions` array and are used for ongoing trading operations after account setup is complete.

### `placeOrder`

Places a new order — market, limit, or with attached take-profit/stop-loss triggers. If the requested leverage differs from the current setting, the backend automatically prepends an `updateLeverage` action step.

|                 |                                                                                                                                                     |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Signers**     | `SDK`                                                                                                                                               |
| **Params**      | `PlaceOrderParams` — `{ market, side, type?, size, price?, leverage?, marginMode?, reduceOnly?, timeInForce?, expiresAt?, takeProfit?, stopLoss? }` |
| **SDK methods** | `placeOrder()`                                                                                                                                      |

### `placeTriggerOrder`

Places standalone take-profit and/or stop-loss triggers on an existing position, independent of a new order. The trigger size is determined by the current position.

|                 |                                                                        |
| --------------- | ---------------------------------------------------------------------- |
| **Signers**     | `SDK`                                                                  |
| **Params**      | `PlaceTriggerOrderParams` — `{ market, side, takeProfit?, stopLoss? }` |
| **SDK methods** | `placeTriggerOrder()`                                                  |

### `placeTwapOrder`

Places a TWAP parent order that executes over a fixed duration via the `twapOrder` exchange action. `randomize` is the only TWAP knob exposed to callers — sub-order cadence and the slippage cap are fixed venue-side. Builder fees attach only to the `builder` field on a regular order; the TWAP action's wire omits that field entirely.

|                 |                                                                                             |
| --------------- | ------------------------------------------------------------------------------------------- |
| **Signers**     | `SDK`                                                                                       |
| **Params**      | `PlaceTwapOrderParams` — `{ market, side, size, durationSeconds, reduceOnly?, randomize? }` |
| **SDK methods** | `placeTwapOrder()`                                                                          |

`durationSeconds` must be a whole number of minutes (a multiple of 60) between 300 and 604800 seconds (5 minutes–7 days) — the venue's wire only carries whole minutes. On success, `ActionResult.twapId` carries Hyperliquid's numeric TWAP identifier, read from the ack's `status.running.twapId`; a TWAP parent's identity lives entirely on that `twapId` channel, so this action never returns an `orderId`.

### `cancelOrder`

Cancels one or more open orders or trigger orders by ID.

|                 |                                 |
| --------------- | ------------------------------- |
| **Signers**     | `SDK`                           |
| **Params**      | `CancelOrderParams` — `{ ids }` |
| **SDK methods** | `cancelOrders()`                |

### `cancelTwapOrder`

Cancels a running TWAP parent by id via the `twapCancel` exchange action.

|                 |                                                |
| --------------- | ---------------------------------------------- |
| **Signers**     | `SDK`                                          |
| **Params**      | `CancelTwapOrderParams` — `{ market, twapId }` |
| **SDK methods** | `cancelTwapOrder()`                            |

`market` is required because the cancel wire is keyed by asset id, and asset resolution for a `twapId` is only possible with that market context supplied by the caller; `twapId` is the numeric id returned from `placeTwapOrder`.

### `modifyOrder`

Modifies existing orders in-place — change price, size, or trigger parameters without cancelling and re-placing.

|                 |                                                                                                |
| --------------- | ---------------------------------------------------------------------------------------------- |
| **Signers**     | `SDK`                                                                                          |
| **Params**      | `ModifyOrderParams` — `{ modifications: [{ id, price?, size?, triggerPrice?, limitPrice? }] }` |
| **SDK methods** | `modifyOrders()`                                                                               |

### `updateLeverage`

Changes the leverage setting for an asset. This affects new orders and existing positions on that asset.

|             |                                                                                                                 |
| ----------- | --------------------------------------------------------------------------------------------------------------- |
| **Signers** | `SDK`                                                                                                           |
| **Params**  | `UpdateLeverageParams` — `{ market, leverage, marginMode? }`                                                    |
| **Note**    | Usually generated automatically by `placeOrder` when the requested leverage or margin mode differs from current |

### `updatePositionMargin`

Adds or removes margin on an isolated position. Use this to adjust liquidation price without changing the position size.

|                 |                                                                                |
| --------------- | ------------------------------------------------------------------------------ |
| **Signers**     | `SDK`                                                                          |
| **Params**      | `UpdatePositionMarginParams` — `{ market, action: 'add' \| 'remove', amount }` |
| **SDK methods** | `updatePositionMargin()`                                                       |

### `sendAsset`

Transfers collateral between Hyperliquid sub-exchanges (HIP-3 providers). For example, moving USDC from the default venue to the `xyz` venue, or between any two markets within the provider.

|             |                                                                                                                                                                 |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Signers** | `USER` (agents cannot transfer assets)                                                                                                                          |
| **Params**  | `SendAssetParams` — `{ collateral, sourceDex, destinationDex, amount }`                                                                                         |
| **Note**    | Under `unifiedAccount` mode, like-for-like quote assets are already shared — this is primarily useful for transfers between markets with different quote assets |

> **Withdrawals** are not part of the trading actions — they require a direct user signature and are documented separately. See [Withdrawals](/providers/hyperliquid/withdrawals).

## `categories`

The `categories` array on the provider lists all trading categories. Each category's `id` is used as the `categoryId` field in `MarketRef`. The list is built dynamically from Hyperliquid's `perpDexs` endpoint at request time, so it always reflects the current set of active venues — including any HIP-3 sub-dexes that have launched since this page was written.

A typical response looks like:

| Category ID      | Quote Asset                      | Description                                                                                                                    |
| ---------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `hyperliquid`    | USDC                             | Default perpetuals venue (Hyperliquid's main `''` perp dex)                                                                    |
| `<sub-dex name>` | USDC / USDH / USDE / USDT0 / ... | One entry per active HIP-3 sub-dex (`xyz`, `flx`, `hyna`, etc.). Quote asset is determined by the sub-dex's `collateralToken`. |
| `spot`           | —                                | Spot category (no quote asset)                                                                                                 |

<Info>
  The set of HIP-3 sub-dexes changes as new venues launch — names and quote assets are not stable. Always read the live `GET /providers` response (or `getProviders()` from the SDK) to discover the current set of categories and their quote assets, rather than hard-coding values from this page.
</Info>
