# Book Ticker Stream

Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.

## Update Speed

* Pushed on each block.

## Subscribe Request

* Subscribe Schema

See [`WsBookTickerSubscriptionParams`](/documentation/trading-api/rest-v1/schema.md#wsbooktickersubscriptionparams) in [Schema](/documentation/trading-api/rest-v1/schema.md).

```typescript
interface SubscribeRequest {
  op: "subscribe";
  id: number | null; // Optional client originated request identifier sent as acknowledgment in the response.
  params: WsBookTickerSubscriptionParams;
}
```

* Subscribe Ack Schema

See [`WsBookTickerSubscriptionResult`](/documentation/trading-api/rest-v1/schema.md#wsbooktickersubscriptionresult) in [Schema](/documentation/trading-api/rest-v1/schema.md).

```typescript
interface SubscriptionResult {
  op: "subscribe";
  id: number | null; // Optional client originated request identifier sent as acknowledgment in the response.
  result: WsBookTickerSubscriptionResult | null;
  success: boolean; // Indicates if the request was successfully processed by the engine.
  connID: string;
  error: string | null; // Condition: If success is false. Error message.
  time_in: number; // The timestamp when the subscription was received on the wire, just prior to parsing data, in milliseconds.
  time_out: number; // The timestamp when the acknowledgement was sent on the wire, just prior to transmitting data, in milliseconds.
}
```

* Example: Subscribe

```json
{
  "op": "subscribe",
  "params": {
    "channel": "bookTicker",
    "symbols": ["vBTC_vUSDC"]
  }
}
```

* Example: Subscribe Ack

```json
{
  "op": "subscribe",
  "result": {
    "channel": "bookTicker",
    "symbol": "vBTC_vUSDC"
  },
  "success": true,
  "connID": "0x8f0bb08be0c03d12e3cd021b665e9a8d",
  "time_in": 1672515782130,
  "time_out": 1672515782136
}
```

## Unsubscribe Request

* Unsubscribe Schema

See [`WsBookTickerSubscriptionParams`](/documentation/trading-api/rest-v1/schema.md#wsbooktickersubscriptionparams) in [Schema](/documentation/trading-api/rest-v1/schema.md).

```typescript
interface UnsubscribeRequest {
  op: "unsubscribe";
  id: number | null; // Optional client originated request identifier sent as acknowledgment in the response.
  params: WsBookTickerSubscriptionParams;
}
```

* Unsubscribe Ack Schema

See [`WsBookTickerSubscriptionResult`](/documentation/trading-api/rest-v1/schema.md#wsbooktickersubscriptionresult) in [Schema](/documentation/trading-api/rest-v1/schema.md).

```typescript
interface UnsubscriptionResult {
  op: "unsubscribe";
  id: number | null; // Optional client originated request identifier sent as acknowledgment in the response.
  result: WsBookTickerSubscriptionResult | null;
  success: boolean; // Indicates if the request was successfully processed by the engine.
  connID: string;
  error: string | null; // Condition: If success is false. Error message.
  time_in: number; // The timestamp when the subscription was received on the wire, just prior to parsing data, in milliseconds.
  time_out: number; // The timestamp when the acknowledgement was sent on the wire, just prior to transmitting data, in milliseconds.
}
```

* Example: Unsubscribe

```json
{
  "op": "unsubscribe",
  "params": {
    "channel": "bookTicker",
    "symbols": ["vBTC_vUSDC"]
  }
}
```

* Example: Unsubscribe Ack

```json
{
  "op": "unsubscribe",
  "result": {
    "channel": "bookTicker",
    "symbol": "vBTC_vUSDC"
  },
  "success": true,
  "connID": "0x8f0bb08be0c03d12e3cd021b665e9a8d",
  "time_in": 1672515782130,
  "time_out": 1672515782136
}
```

## Snapshot / Update Response

* Snapshot / Update Schema

See [`WsBookTickerData`](/documentation/trading-api/rest-v1/schema.md#wsbooktickerdata) in [Schema](/documentation/trading-api/rest-v1/schema.md).

```typescript
interface BookTickerResponse {
  channel: "bookTicker";
  type: "snapshot" | "update";
  data: Array<WsBookTickerData>;
}
```

* Example: Snapshot

```json
{
  "channel": "bookTicker",
  "type": "snapshot",
  "data": [
    {
      "E": 1766844967026,
      "s": "vBTC_vUSDC",
      "u": 2631,
      "a": "99380",
      "A": "0.94474",
      "b": "99165",
      "B": "0.94382"
    }
  ]
}
```

* Example: Update

```json
{
  "channel": "bookTicker",
  "type": "update",
  "data": [
    {
      "E": 1766844967026,
      "s": "vBTC_vUSDC",
      "u": 2631,
      "a": "99380",
      "A": "0.94474",
      "b": "99165",
      "B": "0.94382"
    }
  ]
}
```


---

# Agent Instructions: 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:

```
GET https://sodex.com/documentation/trading-api/websocket-v1/book-ticker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
