# All Book Tickers Stream

Pushes any update to the best bid or ask's price or quantity in real-time for all symbols. **Note that only tickers that have changed will be present in the array**.

## Update Speed

* Pushed on each block.

## Subscribe Request

* Subscribe Schema

See [`WsAllBookTickerSubscriptionParams`](https://sodex.com/documentation/rest-v1/schema#wsallbooktickersubscriptionparams) in [Schema](https://sodex.com/documentation/api/rest-v1/schema).

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

* Subscribe Ack Schema

See [`WsAllBookTickerSubscriptionResult`](https://sodex.com/documentation/rest-v1/schema#wsallbooktickersubscriptionresult) in [Schema](https://sodex.com/documentation/api/rest-v1/schema).

```typescript
interface SubscriptionResult {
  op: "subscribe";
  id: number | null; // Optional client originated request identifier sent as acknowledgment in the response.
  result: WsAllBookTickerSubscriptionResult | 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": "allBookTicker"
  }
}
```

* Example: Subscribe Ack

```json
{
  "op": "subscribe",
  "result": {
    "channel": "allBookTicker"
  },
  "success": true,
  "connID": "0xddca459c692dbc0e7e7188209856c7b5",
  "time_in": 1672515782130,
  "time_out": 1672515782136
}
```

## Unsubscribe Request

* Unsubscribe Schema

See [`WsAllBookTickerSubscriptionParams`](https://sodex.com/documentation/rest-v1/schema#wsallbooktickersubscriptionparams) in [Schema](https://sodex.com/documentation/api/rest-v1/schema).

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

* Unsubscribe Ack Schema

See [`WsAllBookTickerSubscriptionResult`](https://sodex.com/documentation/rest-v1/schema#wsallbooktickersubscriptionresult) in [Schema](https://sodex.com/documentation/api/rest-v1/schema).

```typescript
interface UnsubscriptionResult {
  op: "unsubscribe";
  id: number | null; // Optional client originated request identifier sent as acknowledgment in the response.
  result: WsAllBookTickerSubscriptionResult | 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": "allBookTicker"
  }
}
```

* Example: Unsubscribe Ack

```json
{
  "op": "unsubscribe",
  "result": {
    "channel": "allBookTicker"
  },
  "success": true,
  "connID": "0xddca459c692dbc0e7e7188209856c7b5",
  "time_in": 1672515782130,
  "time_out": 1672515782136
}
```

## Snapshot / Update Response

* Snapshot / Update Schema

See [`WsBookTickerData`](https://sodex.com/documentation/rest-v1/schema#wsbooktickerdata) in [Schema](https://sodex.com/documentation/api/rest-v1/schema).

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

* Example: Snapshot

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

* Example: Update

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