> For the complete documentation index, see [llms.txt](https://docs.outpoll.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams.md).

# Account & History Streams

Order, balance, activity, and trade WebSocket endpoints

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

### Endpoint pages

* [Order Updates](/api/rest-api/websockets/account-and-history-streams/order-updates.md) — order execution and TP/SL status events
* [Balance Updates](/api/rest-api/websockets/account-and-history-streams/balance-updates.md) — initial balance snapshot and live balance deltas
* [Order Feed](/api/rest-api/websockets/account-and-history-streams/order-feed.md) — live order status events from the history service
* [Activity Feed](/api/rest-api/websockets/account-and-history-streams/activity-feed.md) — live event activity with subscribe and unsubscribe
* [Last Trades Feed](/api/rest-api/websockets/account-and-history-streams/last-trades-feed.md) — 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         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.outpoll.com/api/rest-api/websockets/account-and-history-streams.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
