# All Tickers Stream

24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. **Note that only tickers that have changed will be present in the array**.

## Update Speed

* Pushed on each block that is at least 1 second since the last push.

## Subscribe Request

* Subscribe Schema

See [`WsAllTickerSubscriptionParams`](https://sodex.com/documentation/rest-v1/schema#wsalltickersubscriptionparams) 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: WsAllTickerSubscriptionParams;
}
```

* Subscribe Ack Schema

See [`WsAllTickerSubscriptionResult`](https://sodex.com/documentation/rest-v1/schema#wsalltickersubscriptionresult) 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: WsAllTickerSubscriptionResult | 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": "allTicker"
  }
}
```

* Example: Subscribe Ack

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

## Unsubscribe Request

* Unsubscribe Schema

See [`WsAllTickerSubscriptionParams`](https://sodex.com/documentation/rest-v1/schema#wsalltickersubscriptionparams) 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: WsAllTickerSubscriptionParams;
}
```

* Unsubscribe Ack Schema

See [`WsAllTickerSubscriptionResult`](https://sodex.com/documentation/rest-v1/schema#wsalltickersubscriptionresult) 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: WsAllTickerSubscriptionResult | 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": "allTicker"
  }
}
```

* Example: Unsubscribe Ack

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

## Snapshot / Update Response

* Snapshot / Update Schema

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

```typescript
interface AllTickerResponse {
  channel: "allTicker";
  type: "snapshot" | "update";
  data: Array<WsTickerData>;
}
```

* Example: Snapshot

```json
{
  "channel": "allTicker",
  "type": "snapshot",
  "data": [
    {
      "E": 1766907127667,
      "s": "BTC-USD",
      "c": "87653",
      "Q": "0.00081",
      "w": "87542.1842812399126757",
      "a": "106482",
      "A": "0.00001",
      "b": "106394",
      "B": "0.00016",
      "p": "108",
      "P": 0.12336512650637,
      "o": "87545",
      "h": "87923",
      "l": "87274",
      "v": "5842.97664",
      "q": "511506937.76986",
      "O": 1766820725123,
      "C": 1766907125123
    },
    {
      "E": 1766907127667,
      "s": "ETH-USD",
      "c": "2938.2",
      "Q": "0.0098",
      "w": "2940.5430181364198871",
      "a": "3093.4",
      "A": "1.2233",
      "b": "3089",
      "B": "1.2582",
      "p": "4.8",
      "P": 0.16363264471262,
      "o": "2933.4",
      "h": "2957.8",
      "l": "2916.6",
      "v": "16384.1156",
      "q": "48178196.73592",
      "O": 1766820723533,
      "C": 1766907123533
    }
  ]
}
```

* Example: Update

```json
{
  "channel": "allTicker",
  "type": "update",
  "data": [
    {
      "E": 1766907127667,
      "s": "BTC-USD",
      "c": "87653",
      "Q": "0.00081",
      "w": "87542.1842812399126757",
      "a": "106482",
      "A": "0.00001",
      "b": "106394",
      "B": "0.00016",
      "p": "108",
      "P": 0.12336512650637,
      "o": "87545",
      "h": "87923",
      "l": "87274",
      "v": "5842.97664",
      "q": "511506937.76986",
      "O": 1766820725123,
      "C": 1766907125123
    }
  ]
}
```
