> For the complete documentation index, see [llms.txt](https://docs.flash.trade/flash-trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flash.trade/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/guides/limit-orders.md).

# Limit orders

Place, edit, and cancel resting limit orders.

A limit order rests until the market reaches your price. Up to **5 limit orders** per market + side.

## Place

Placing a limit order goes through `open-position` — set `orderType: "LIMIT"` and a `limitPrice`:

```bash
curl -X POST $FLASH_API_URL/transaction-builder/open-position -d '{
  "inputTokenSymbol": "USDC", "outputTokenSymbol": "SOL",
  "inputAmountUi": "100.0", "leverage": 5.0, "tradeType": "LONG",
  "orderType": "LIMIT", "limitPrice": "150.00", "owner": "<WALLET>"
}'
```

Attach exits with `takeProfit` / `stopLoss` in the same call.

## Edit

Change price, size, or attached TP/SL. Per on-chain semantics: for `limitPriceUi` / `sizeAmountUi`, omit (or send `"0"`) to **keep existing**. TP/SL do **not** persist across an edit — re-send a value to keep it, `"0"`/omit removes it.

```bash
curl -X POST $FLASH_API_URL/transaction-builder/edit-limit-order -d '{
  "marketSymbol": "SOL", "side": "LONG", "orderId": 0,
  "limitPriceUi": "148.00", "sizeAmountUi": "0.5", "owner": "<WALLET>"
}'
```

## Cancel

```bash
curl -X POST $FLASH_API_URL/transaction-builder/cancel-limit-order -d '{
  "marketSymbol": "SOL", "side": "LONG", "orderId": 0, "owner": "<WALLET>"
}'
```

Cancelling returns reserved collateral and frees the slot. `orderId` is the slot index (0–4) from the order metrics in [`GET /orders/owner/{owner}`](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/guides/read-positions-and-orders.md).

→ Full fields: [API reference › Trading › Limit orders](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/trading.md#limit-orders)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flash.trade/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/guides/limit-orders.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
