# Event: ORDER_UPDATE

## Event Description

A pending order was added, changed or removed.

## Event Name

`ORDER_UPDATE`

## Response Example

```json
{
  "e": "ORDER_UPDATE",
  "E": 1789012400500,
  "L": 100123,
  "x": "UPDATE",
  "o": 44412350,
  "s": "XAUUSD",
  "ot": "BUY_LIMIT",
  "X": "NEW",
  "mst": 1,
  "q": "0.10",
  "qr": "0.10",
  "p": "2323.00",
  "sp": "0",
  "sl": "2315.00",
  "tp": "0",
  "tif": "GTC",
  "ts": 1789012345690,
  "ex": 0,
  "C": "bot-002"
}
```

| Field | Type | Description |
| - | - | - |
| `e` | STRING | `"ORDER_UPDATE"` |
| `E` | LONG | Event time, Unix ms. |
| `L` | LONG | Login. |
| `x` | ENUM | What happened to the record: `NEW` (order appeared), `UPDATE` (changed), `DELETE` (left the book — filled, cancelled or expired; read `X` for which). |
| `o` | LONG | Order id. |
| `s` | STRING | Symbol. |
| `ot` | ENUM | Order type: `BUY_LIMIT`, `SELL_LIMIT`, `BUY_STOP`, `SELL_STOP`, `BUY_STOP_LIMIT`, `SELL_STOP_LIMIT`. May also be `BUY` or `SELL` for a market order passing through the book — those do not rest, so you will normally see them only in the same breath as their `DELETE` — `CLOSE_BY` for a close-by order placed outside this API, or `UNKNOWN_<n>` for an MT5 type this API does not map. |
| `X` | ENUM | Order status: `NEW`, `PARTIALLY_FILLED`, `FILLED`, `CANCELED`, `EXPIRED`, `REJECTED`. |
| `mst` | INT | Raw MT5 order state. Provided so an unmapped state is still readable — see [Common Definition](/common-definition.md#order-state-raw-mt5). |
| `q` | DECIMAL | Initial volume, lots. |
| `qr` | DECIMAL | Remaining volume, lots. |
| `p` | DECIMAL | Order price. |
| `sp` | DECIMAL | Stop-limit price. **Currently always `"0"`** — the underlying event does not yet carry the stop-limit trigger. Read it back from `GET /v1/openOrders` until it does. |
| `sl` | DECIMAL | Stop loss. `"0"` if none. |
| `tp` | DECIMAL | Take profit. `"0"` if none. |
| `tif` | ENUM | `GTC`, `DAY`, `GTD`, `GTD_DAY`. **Currently inferred, not read:** `GTD` when the order carries an expiration, `GTC` otherwise. `DAY` and `GTD_DAY` are therefore not distinguishable on this event until the underlying event carries the order's time type — read `GET /v1/openOrders` if you must know which. |
| `ts` | LONG | Order setup time, Unix ms. |
| `ex` | LONG | Expiration, Unix ms. `0` if none. |
| `C` | STRING | Your `clientOrderId`, resolved from the order's correlation tag. Absent for orders this API did not place, and for orders another API key placed on a shared login. |

`x: "DELETE"` with `X: "FILLED"` means the pending order triggered — expect a `DEAL` and a
`POSITION_UPDATE` alongside it.

> Two fields on this event are **narrower than they will be**: `tif` is inferred and `sp` is always
> `"0"`. Both widen additively — no field changes type or meaning — so a client written against them
> today keeps working.
