> For the complete documentation index, see [llms.txt](https://k4k3ru.gitbook.io/k4k3ru-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k4k3ru.gitbook.io/k4k3ru-docs/api/market-hub/order-book-subscribe.md).

# Subscribe to Consolidated OrderBook Data

`MarketHub.OrderBook.Subscribe` creates an authenticated WebSocket subscription for venue-independent market-depth updates. Use `MarketHub.OrderBook.Unsubscribe` with the same normalized parameters to remove it.

## Subscribe

```json
{
  "id": "1",
  "method": "MarketHub.OrderBook.Subscribe",
  "params": {
    "marketType": "spot",
    "symbol": "BTC/USDC",
    "depth": 3
  },
  "auth": {
    "apiKey": "YOUR_API_KEY",
    "timestamp": 1788533857,
    "nonce": "UNIQUE_NONCE",
    "signature": "REQUEST_SIGNATURE"
  }
}
```

The acknowledgement returns the normalized subscription parameters. `depth` defaults to `3` and accepts values from `1` through `20`.

Subsequent `ob` events contain the compact OrderBook result fields documented by [Get a Consolidated OrderBook Snapshot](/k4k3ru-docs/api/market-hub/get-order-book-snapshot.md):

```json
{
  "e": "ob",
  "data": {
    "ac": "crypto",
    "mt": "spot",
    "s": "BTC/USDC",
    "d": 3,
    "b": [{"p": "78891.9", "q": "0.016801"}],
    "a": [{"p": "78892", "q": "0.01838"}],
    "svc": 2,
    "v": 6842374982615800523,
    "ts": 1788533857086000
  }
}
```

Order-book and eligible synthetic BBO updates can both produce a new consolidated depth event.

## Unsubscribe

```json
{
  "id": "2",
  "method": "MarketHub.OrderBook.Unsubscribe",
  "params": {
    "marketType": "spot",
    "symbol": "BTC/USDC",
    "depth": 3
  },
  "auth": {
    "apiKey": "YOUR_API_KEY",
    "timestamp": 1788533860,
    "nonce": "ANOTHER_UNIQUE_NONCE",
    "signature": "REQUEST_SIGNATURE"
  }
}
```

Subscribe and Unsubscribe require valid signed WebSocket requests. Unsubscribe parameters must identify the same normalized subscription, including `depth` and any `sourceFilter`. Individual contributing Venue names are not returned.

The same bid-anchored non-crossed consolidation as Get applies: asks at or below the best bid are excluded before the requested depth is selected.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://k4k3ru.gitbook.io/k4k3ru-docs/api/market-hub/order-book-subscribe.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
