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

# TWAP Updates

## Subscribe

```json theme={null}
{
  "method": "subscribe",
  "subscription": {
    "type": "twapUpdates",
    "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb"
  }
}
```

## Response

```json theme={null}
{
  "channel": "twapUpdates",
  "data": {
    "isSnapshot": true,
    "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb",
    "twaps": [
      {
        "twapId": "0x1a2b3c...",
        "status": "active",
        "asset": "BTC",
        "side": "buy",
        "totalSz": "0.25",
        "filledSz": "0.10",
        "remainingSz": "0.15",
        "reduceOnly": false,
        "slicesFilled": 2,
        "slicesPartial": 0,
        "slicesRejected": 0,
        "totalNotional": "5030.0",
        "avgFillPx": "50300",
        "durationMs": 1800000,
        "sliceIntervalMs": 300000,
        "createdAt": 1701234567890,
        "startedAt": 1701234567890,
        "expectedEndAt": 1701236367890,
        "currentSliceIndex": 2,
        "totalExpectedSlices": 7,
        "randomize": true,
        "updatedAt": 1701235167890,
        "completedAt": null,
        "canceledAt": null,
        "reason": null
      }
    ]
  }
}
```

## Response Fields

| Field                   | Type    | Description                                               |
| ----------------------- | ------- | --------------------------------------------------------- |
| `data.isSnapshot`       | boolean | `true` for the initial active-TWAP snapshot, else `false` |
| `data.user`             | string  | Lowercased user address                                   |
| `data.twaps`            | array   | One or more TWAP updates                                  |
| `twaps[].twapId`        | string  | TWAP order id                                             |
| `twaps[].status`        | string  | Current TWAP status                                       |
| `twaps[].asset`         | string  | Perp market symbol or spot pair base symbol               |
| `twaps[].side`          | string  | `"buy"` or `"sell"`                                       |
| `twaps[].totalSz`       | string  | Total requested size                                      |
| `twaps[].filledSz`      | string  | Aggregate filled size                                     |
| `twaps[].remainingSz`   | string  | Remaining size                                            |
| `twaps[].reduceOnly`    | boolean | Whether the TWAP is reduce-only                           |
| `twaps[].totalNotional` | string  | Aggregate filled notional value                           |
| `twaps[].avgFillPx`     | string  | Server-derived VWAP, or `"0"` before any fills            |

## Notes

<Note>
  * The server sends an initial snapshot of the user's currently active TWAPs immediately after a
    successful subscription. - Incremental updates are then emitted as TWAP state changes during
    execution. - Spot TWAP updates use the same payload shape as perp TWAP updates; child order
    updates carry `twapOrderId` and `twapSliceIndex` for grouping. - Messages are scoped by `user`;
    clients should always include the user address in subscribe and unsubscribe requests. - The
    payload shape matches the TWAP REST responses for `twapListActive` and `twapListHistory`.
</Note>
