# Order Commands

## What is an order?

An order is an instruction to buy or sell an asset on Hyperliquid. In perpetual futures, placing a buy order opens a long position (you profit if the price goes up), and placing a sell order opens a short position (you profit if the price goes down). You can also use orders to close a position you already have open.

There are two main order types: market orders and limit orders.

## Market orders

A market order executes immediately at the best available price. You are not choosing a specific price, you are saying "fill this now." Market orders are useful when speed matters more than getting a precise entry price.

Use `buy` or `long` to go long. Use `sell` or `short` to go short.

To place a market order:

```bash
byreal-perps-cli order market long 0.01 BTC
byreal-perps-cli order market short 1 ETH
```

You can attach a take-profit and stop-loss at the same time using `--tp` and `--sl`. This places your main order alongside two conditional trigger orders as a group, so your exits are set from the moment the trade opens:

```bash
byreal-perps-cli order market long 0.01 BTC --tp 110000 --sl 90000
```

See the [TP/SL guide](broken://pages/b835be1872bec3c8dd75d544b175b580ed3d49aa) for a full explanation of how these work.

## Limit orders

A limit order sits in the order book and waits until the market reaches the price you set. You are saying "only fill this at my price or better." Limit orders are useful when you want to enter at a specific level rather than whatever the market is at right now.

Limit orders stay open until they are filled or you cancel them (good-till-cancelled by default).

```bash
byreal-perps-cli order limit buy 0.01 BTC 95000
byreal-perps-cli order limit buy 0.01 BTC 95000 --tp 110000 --sl 90000
```

You can change how long the order stays open with `--tif`. Options are `Gtc` (good-till-cancelled, the default), `Ioc` (immediate-or-cancel, fills what it can and cancels the rest), and `Alo` (add-liquidity-only, only fills if it can go on the book without immediately matching).

## Managing open orders

To view all your open orders, run `byreal-perps-cli order list`.

To cancel a specific order, you need the coin name and the order ID: `byreal-perps-cli order cancel BTC 123456789`.

To cancel all open orders at once, run `byreal-perps-cli order cancel-all -y`. The `-y` flag confirms the action since cancelling all orders is irreversible.

## Order commands summary

| Command                                    | Description                                 |
| ------------------------------------------ | ------------------------------------------- |
| `order market <side> <size> <coin>`        | Place a market order that fills immediately |
| `order limit <side> <size> <coin> <price>` | Place a limit order at a specific price     |
| `order list`                               | View all open orders                        |
| `order cancel <coin> <order-id>`           | Cancel a specific order                     |
| `order cancel-all -y`                      | Cancel all open orders                      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.byreal.io/byreal-perps-agent-skills/order-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
