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

# WebSocket orderUpdates: Incremental Order State Changes

> Subscribe to orderUpdates to receive real-time incremental order state changes — new orders, partial fills, cancels, and TP/SL events.

The `orderUpdates` channel sends incremental state changes for every order associated with an account — the moment an order is placed, partially filled, fully filled, cancelled, or when a conditional (TP/SL) order triggers or is cancelled. Because this channel is incremental, it does not send a snapshot on subscribe. If you need an initial full view of all active orders, subscribe to [`openOrders`](/websocket/open-orders) instead, then switch to (or layer on) `orderUpdates` for ongoing changes.

Pass the account's wallet address (not the numeric account ID) as the `user` parameter.

## Subscribing

```json theme={"system"}
{
  "method": "subscribe",
  "subscription": {"type": "orderUpdates", "user": "0xabc...123"}
}
```

## Push envelope

All order update messages share this envelope structure:

```json theme={"system"}
{
  "msg": "OrderUpdate",
  "channel": "orderUpdates.0xabc...123",
  "data": [ { ...entry... } ],
  "ts": 1782279307885
}
```

The `data` array may contain multiple entries when several orders change state in the same block.

## Regular order entry

```json theme={"system"}
{
  "id": "15",
  "r": "144115188075856500",
  "cid": "1778844423064",
  "a": "5",
  "c": 1,
  "b": "B",
  "t": "L",
  "tif": "Gtc",
  "p": "50",
  "s": "10",
  "st": "Open"
}
```

## Field reference

| Field | Type   | Description                                                                                                                                |
| ----- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`  | string | Unique order ID assigned by the exchange                                                                                                   |
| `r`   | string | Request ID for correlating with the original action that created this order                                                                |
| `cid` | string | Client order ID — omitted if you did not set one when placing the order                                                                    |
| `a`   | string | Account ID that owns this order                                                                                                            |
| `c`   | number | Contract ID                                                                                                                                |
| `b`   | string | Direction: `"B"` = buy, `"S"` = sell                                                                                                       |
| `t`   | string | Order type: `"L"` = limit, `"M"` = market                                                                                                  |
| `tif` | string | Time-in-force: `"Gtc"` (good-till-cancel), `"Ioc"` (immediate-or-cancel), `"Alo"` (add-liquidity-only / post-only), `"Fok"` (fill-or-kill) |
| `p`   | string | Order price (raw)                                                                                                                          |
| `s`   | string | Remaining unfilled size (raw) — equals total size minus already-filled size                                                                |
| `st`  | string | Order status: `"Open"`, `"Filled"`, `"Canceled"`                                                                                           |

## Cancel entry

When an order is cancelled, a compact entry is sent with `"st": "Canceled"`. The `s` field carries the remaining unfilled size at the time of cancellation.

```json theme={"system"}
{
  "id": "15",
  "r": "144115188075856500",
  "cid": "1778844423064",
  "a": "5",
  "c": 1,
  "s": "10",
  "st": "Canceled"
}
```

## Conditional (TP/SL) order entry

Conditional orders include `"cond": true` and use a different set of status values:

```json theme={"system"}
{
  "id": "20",
  "a": "5",
  "c": 1,
  "b": "S",
  "t": "M",
  "p": "0",
  "s": "10",
  "tp": "80000",
  "tpt": 0,
  "ro": true,
  "cond": true,
  "st": "Untriggered"
}
```

Additional fields for conditional orders:

| Field  | Type    | Description                                             |
| ------ | ------- | ------------------------------------------------------- |
| `cond` | boolean | `true` identifies this as a conditional order           |
| `tp`   | string  | Trigger price (raw)                                     |
| `tpt`  | number  | Trigger price type: `0` = mark price, `1` = index price |
| `ro`   | boolean | `true` if this is a reduce-only order                   |

Conditional order statuses:

| Status        | Meaning                                                                                                                         |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `Untriggered` | Conditional order is active and waiting for the trigger price                                                                   |
| `Canceled`    | Conditional order was cancelled before triggering                                                                               |
| `Triggered`   | Trigger price was reached; the order has been promoted to a regular order and a new entry with the regular order ID will follow |

<Note>
  `orderUpdates` provides only incremental changes — there is no initial snapshot on subscribe. If you need the full list of currently active orders as a starting point, subscribe to [`openOrders`](/websocket/open-orders) first.
</Note>

<Tip>
  When you place an order, store its `requestId` (`r` field) alongside the order. When you receive an `OrderUpdate`, match on `r` to confirm which of your pending actions the update corresponds to — especially useful when placing orders in rapid succession.
</Tip>
