# Event: DEAL

## Event Description

An execution. This is the event that tells you an order filled.

## Event Name

`DEAL`

## Response Example

```json
{
  "e": "DEAL",
  "E": 1789012345812,
  "L": 100123,
  "d": 55512345,
  "o": 44412345,
  "p": 44412345,
  "s": "XAUUSD",
  "S": "BUY",
  "en": "IN",
  "v": "0.10",
  "pr": "2331.42",
  "rp": "0.0000",
  "n": "-0.7000",
  "sw": "0.0000",
  "c": "signal-7",
  "C": "bot-001",
  "T": 1789012345000
}
```

| Field | Type | Description |
| - | - | - |
| `e` | STRING | `"DEAL"` |
| `E` | LONG | Event time, Unix ms. |
| `L` | LONG | Login. |
| `d` | LONG | Deal id. **The natural key — dedupe on it.** |
| `o` | LONG | Order id that produced the deal. |
| `p` | LONG | Position id the deal opened, added to or closed. |
| `s` | STRING | Symbol. |
| `S` | ENUM | Deal side, `BUY` or `SELL`. The direction of the **deal**, not of the position: a `SELL` with `en: "OUT"` closes a long. |
| `en` | ENUM | Deal entry: `IN`, `OUT`, `INOUT`, `OUT_BY`. See [Common Definition](/common-definition.md#deal-entry). |
| `v` | DECIMAL | Volume, lots. |
| `pr` | DECIMAL | Execution price. |
| `rp` | DECIMAL | Realised profit. Non-zero only on `OUT`, `INOUT`, `OUT_BY`. |
| `n` | DECIMAL | Commission on this deal. Usually negative. |
| `sw` | DECIMAL | Swap booked with this deal. |
| `c` | STRING | The comment **as stored on the MT5 deal**. For a deal this API caused, that is your `comment` with the service's 7-character correlation tag appended — longer than what you sent. See [Comments and deal attribution](/trade.md#comments-and-deal-attribution). |
| `C` | STRING | Your `clientOrderId`, resolved from the correlation tag (or from the trade server's answer when it provides one). **This is the field to route on.** Absent for deals this API did not cause — the account holder and the broker can trade the account too, and a stop loss or take profit firing produces an untagged deal. Also absent for a deal caused by **another API key** that shares the login: a `clientOrderId` belongs to the key that sent it and is only ever published on that key's streams. |
| `T` | LONG | Deal time, Unix ms (MT5 resolution is seconds, so this is a multiple of 1000). |

> **Duplicate `DEAL` events are possible by design.** Gap-fill and reconciliation can republish a
> deal that was already delivered. **Dedupe on `d`.** A consumer that books P\&L without deduping
> will double-count.

Only trading deals are delivered. Balance operations, credit grants and other non-trading deal
types do not appear here; their effect shows up on [`ACCOUNT_UPDATE`](/user-data-streams/account_update.md).
