> For the complete documentation index, see [llms.txt](https://docs.pearprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pearprotocol.io/api-integration/trade-activity/open-order.md).

# Open Order

Open orders are pending orders that have not yet fully executed.

#### Access

* **REST**: `GET /orders/open`
* **WebSocket**: `open-orders` channel (requires address)

#### What Counts as Open

Only orders with status `OPEN` or `PARTIALLY_FILLED` and type `TRIGGER`, `TP`, or `SL` are returned. MARKET orders execute immediately and never appear here. TWAP orders have their own monitoring channel (`twap-details`).

#### Response Shape

Each open order contains:

* `orderId` — unique order identifier
* `orderType` — `TRIGGER`, `TP`, or `SL`
* `status` — `OPEN` or `PARTIALLY_FILLED`
* `positionId` — linked position (for TP/SL orders)
* `parameters` — order-type-specific config (leverage, USD value, trigger conditions, etc.)
* `longAssets` / `shortAssets` — each with `asset`, `weight`, `size` (planned), and `filledSize` (executed so far)
* `createdAt` / `updatedAt`

#### Order Types in Open Orders

| Type      | When it appears                                                                             | Triggered by                             |
| --------- | ------------------------------------------------------------------------------------------- | ---------------------------------------- |
| `TRIGGER` | User placed a conditional order waiting for price/ratio/BTC dom/prediction market condition | Oracle condition met                     |
| `TP`      | Take profit set on an open position                                                         | Position ROI or price reaching threshold |
| `SL`      | Stop loss set on an open position                                                           | Position ROI or price reaching threshold |

#### Lifecycle

```
OPEN → PROCESSING → EXECUTED
                  → FAILED
     → PARTIALLY_FILLED → EXECUTED
     → CANCELLED
```

* `OPEN`: order created, waiting for trigger condition
* `PARTIALLY_FILLED`: some fills received (e.g., TWAP chunks or partial execution)
* `PROCESSING`: trigger condition met, execution in progress
* `EXECUTED`: fully filled
* `FAILED`: execution error (e.g., insufficient margin, liquidity)
* `CANCELLED`: user cancelled or system cancelled

#### Real-Time Updates

The `open-orders` channel refreshes automatically after trade execution, position close, or TP/SL changes. No manual polling needed — subscribe once and receive updates.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.pearprotocol.io/api-integration/trade-activity/open-order.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
