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

# Orders

> Understanding order lifecycle and statuses on River Markets

## Order Statuses

Every order on River Markets goes through a lifecycle represented by its status. Understanding these statuses helps you track and manage your orders effectively.

| Status               | Description                                                                  |
| -------------------- | ---------------------------------------------------------------------------- |
| `PENDING_SUBMISSION` | Live: order received, awaiting exchange submission.                          |
| `PROCESSING`         | Live: being processed by the order consumer.                                 |
| `RESTING`            | Live: on the exchange order book (may include partially-filled live orders). |
| `EXECUTED`           | Terminal: fully filled.                                                      |
| `PARTIALLY_FILLED`   | Terminal: cancelled with some quantity filled.                               |
| `CANCELLED`          | Terminal: cancelled with no fills.                                           |
| `REJECTED`           | Terminal: rejected by exchange (see order details for reason).               |

A resting order that becomes partially filled stays in `RESTING` until it either fully fills (`EXECUTED`) or is cancelled (`PARTIALLY_FILLED` if any qty was filled, otherwise `CANCELLED`).

### Lifecycle

```mermaid theme={null}
stateDiagram-v2
    [*] --> PENDING_SUBMISSION
    PENDING_SUBMISSION --> PROCESSING
    PROCESSING --> RESTING
    PROCESSING --> REJECTED
    RESTING --> EXECUTED
    RESTING --> PARTIALLY_FILLED : cancel after partial fill
    RESTING --> CANCELLED : cancel with no fills
    EXECUTED --> [*]
    PARTIALLY_FILLED --> [*]
    CANCELLED --> [*]
    REJECTED --> [*]
```

### Aggregated Fields

Each order includes computed fields from its fills:

* **`traded_qty`** — Total quantity executed across all fills.
* **`average_price`** — Volume-weighted average fill price.
* **`fees_paid`** — Total fees incurred from fills.
