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

# WebSocket bbo Channel: Best Bid and Ask Price Stream

> Subscribe to bbo over WebSocket for the best bid and ask prices per block — far lower bandwidth than the full l2Book order book channel.

The `bbo` channel delivers only the best bid (buy-one) and best ask (sell-one) for a contract on every block. If your application only needs the spread or top-of-book price — for example, to display a mid-price or check whether an order would cross — `bbo` is significantly more bandwidth-efficient than subscribing to the full `l2Book`.

## Subscribing

```json theme={"system"}
{"method": "subscribe", "subscription": {"type": "bbo", "asset": "1"}}
```

Replace `"1"` with the numeric contract ID you want to track.

## Push message format

```json theme={"system"}
{
  "channel": "bbo",
  "ts": 1782279307885,
  "data": {
    "asset": "1",
    "time": 1782279300000,
    "bookVersion": 90231,
    "bbo": [
      {"px": "1133770", "sz": "5", "n": 3},
      {"px": "1133780", "sz": "2", "n": 1}
    ]
  }
}
```

## Field reference

<ResponseField name="ts" type="number">
  Server send timestamp in Unix milliseconds. Use this for latency measurement and event ordering across channels.
</ResponseField>

<ResponseField name="data.asset" type="string">
  The contract ID this update belongs to.
</ResponseField>

<ResponseField name="data.time" type="number">
  Block timestamp in Unix milliseconds at which this top-of-book snapshot was captured.
</ResponseField>

<ResponseField name="data.bookVersion" type="number">
  The same monotonically increasing version counter used by `l2Book` for the same asset. You can use this to correlate `bbo` messages with `l2Book` messages or to deduplicate when multiple updates arrive for the same block.
</ResponseField>

<ResponseField name="data.bbo[0]" type="object | null">
  Best bid. `null` when there are no resting bids on the book.

  * **`px`** *(string)* — Best bid price (raw).
  * **`sz`** *(string)* — Total size available at the best bid (raw).
  * **`n`** *(number)* — Number of orders resting at the best bid price.
</ResponseField>

<ResponseField name="data.bbo[1]" type="object | null">
  Best ask. `null` when there are no resting asks on the book.

  * **`px`** *(string)* — Best ask price (raw).
  * **`sz`** *(string)* — Total size available at the best ask (raw).
  * **`n`** *(number)* — Number of orders resting at the best ask price.
</ResponseField>

## Comparing bbo and l2Book

<Tabs>
  <Tab title="Use bbo when…">
    * You only need to display or act on the top-of-book price.
    * You are building a price ticker, mid-price display, or spread monitor.
    * You want to minimise data transfer on mobile or metered connections.
    * You are subscribing to many assets simultaneously and bandwidth matters.
  </Tab>

  <Tab title="Use l2Book when…">
    * You need to render a full depth chart or order book ladder.
    * You are estimating market impact or slippage for larger orders.
    * You need `markPx` and `oraclePx` alongside the book levels.
    * Your strategy reacts to liquidity at multiple price levels.
  </Tab>
</Tabs>

<Note>
  Both `bbo` and `l2Book` share the same `bookVersion` counter for a given asset. If you subscribe to both on the same connection, you can use `bookVersion` to verify they are in sync and to detect any gaps.
</Note>
