# Account & History Streams

Use these streams for private account events and public history broadcasts.

### Endpoint pages

* [Order Updates](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/order-updates) — order execution and TP/SL status events
* [Balance Updates](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/balance-updates) — initial balance snapshot and live balance deltas
* [Order Feed](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/order-feed) — live order status events from the history service
* [Activity Feed](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/activity-feed) — live event activity with subscribe and unsubscribe
* [Last Trades Feed](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams/last-trades-feed) — public stream of the latest platform trades

### Shared authentication

Only private streams need auth:

* Order Updates
* Balance Updates
* Order Feed

Send this message after connect.

```json
{
  "t": "AUTH",
  "d": {
    "apiKey": "<API_KEY>",
    "signature": "<SIGNATURE>",
    "timestamp": "<UNIX_EPOCH_SECONDS>"
  }
}
```

Build `signature` from `timestamp + "GET" + path`.

{% hint style="info" %}
After reconnect, authenticate again and restore every subscription.
{% endhint %}

### Public streams

* **Activity Feed** is public. Use subscribe and unsubscribe messages.
* **Last Trades Feed** is public. Connect and read messages.

### When to use which stream

* Use **Order Updates** right after placing or changing orders.
* Use **Balance Updates** for wallet and position balance changes.
* Use **Order Feed** for history-service order events.
* Use **Activity Feed** for per-event live activity.
* Use **Last Trades Feed** for public trade tape style updates.

### Common errors

```json
{
  "t": "error",
  "e": "event-id",
  "o": ["outcome-id"],
  "d": {
    "error": "Error description"
  }
}
```

| Error                          | Cause                         |
| ------------------------------ | ----------------------------- |
| Invalid or missing credentials | API key auth failed           |
| No outcome IDs provided        | Subscribe without outcome IDs |
| Invalid time range             | `from` is after `to`          |
| Invalid period                 | Unsupported history period    |
| Unknown message type           | Unsupported `t` value         |
