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

# All mids stream

> Receive finalized mid prices for every active market.

```text theme={null}
allMids@f[@<coalesceMs>]
```

This global snapshot stream accepts neither `m` nor `u`. The duration is
optional and defaults to `50` milliseconds.

## Subscribe

```json theme={null}
{"op":"sub","id":5,"t":"allMids@f@500","feedEpoch":0}
```

## Decoded event

The shape below is the inner `message` returned by `decodeExchangeWsEnvelope`
or `decodeExchangeWsMessage`. Every binary socket message also carries an outer
`id: bigint`, matching your subscription ID. Use it to route snapshots, replay,
and live updates. See [binary subscription envelopes](/api/exchange/websocket#binary-subscription-envelope).

```ts theme={null}
interface ExchangeWsAllMidsFrame {
  wireVersion: 1;
  feedEpoch: bigint;
  view: "finalized";
  kind: "allMids";
  mids: Array<{
    marketAddress: string;
    midpoint: bigint;
  }>;
}
```

Each entry contains a lowercase market address and its native pp midpoint. Markets
without both a bid and an ask may be omitted.


## AsyncAPI

````yaml api/exchange/asyncapi.yaml allMids
id: allMids
title: Subscribe to all mids
description: Receive finalized mid prices for every active market.
servers:
  - id: mainnet
    protocol: wss
    host: gateway.mainnet.kuru.io
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: gateway.testnet.kuru.io
    bindings: []
    variables: []
address: /ws
parameters: []
bindings: []
operations:
  - &ref_1
    id: subscribeAllMids
    title: Subscribe all mids
    type: receive
    messages:
      - &ref_2
        id: request
        contentType: application/json
        payload:
          - name: allMids@f subscription
            type: object
            properties:
              - name: op
                type: string
                enumValues:
                  - sub
                required: true
              - name: id
                type: integer
                description: >-
                  JSON integer restricted to JavaScript's exact safe-integer
                  range.
                required: true
              - name: t
                type: string
                required: true
              - name: feedEpoch
                type: integer
                description: Feed namespace. Required when seq is supplied.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - op
            - id
            - t
          properties:
            op:
              type: string
              enum:
                - sub
              x-parser-schema-id: <anonymous-schema-46>
            id: &ref_0
              type: integer
              minimum: 0
              maximum: 9007199254740991
              description: >-
                JSON integer restricted to JavaScript's exact safe-integer
                range.
              x-parser-schema-id: ControlInteger
            t:
              type: string
              pattern: ^allMids@f(@[1-9][0-9]*)?$
              x-parser-schema-id: <anonymous-schema-47>
            feedEpoch:
              allOf:
                - *ref_0
              description: Feed namespace. Required when seq is supplied.
              x-parser-schema-id: FeedEpoch
          x-parser-schema-id: AllMidsSubscription
        title: allMids@f subscription
        example: |-
          {
            "op": "sub",
            "id": 5,
            "t": "allMids@f@500",
            "feedEpoch": 0
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: request
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: allMids
sendOperations:
  - *ref_1
receiveOperations: []
sendMessages:
  - *ref_2
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: allMids
securitySchemes: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.