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

# Crypto Price Stream

> Public spot-price stream (Polymarket-hosted) — `source` is `binance` (e.g. `btcusdt`, `solusdt`, `ethusdt`) or `chainlink` (e.g. `btc/usd`, `eth/usd`, `sol/usd`).

Public spot-price stream (Polymarket-hosted) — `source` is `binance` (e.g. `btcusdt`, `solusdt`, `ethusdt`) or `chainlink` (e.g. `btc/usd`, `eth/usd`, `sol/usd`).


## AsyncAPI

````yaml openpx.asyncapi.yaml crypto
id: crypto
title: Crypto Price Stream
description: >-
  Public spot-price stream (Polymarket-hosted) — `source` is `binance` (e.g.
  `btcusdt`, `solusdt`, `ethusdt`) or `chainlink` (e.g. `btc/usd`, `eth/usd`,
  `sol/usd`).
servers:
  - id: inprocess
    protocol: ws
    host: openpx-engine
    bindings: []
    variables: []
address: /v1/crypto
parameters: []
bindings: []
operations:
  - &ref_8
    id: crypto_subscribe
    title: Subscribe
    description: Add to the active crypto subscription set
    type: send
    messages:
      - &ref_16
        id: crypto_subscribe
        contentType: application/json
        payload:
          - name: Subscribe
            description: Add to the active crypto subscription set
            type: object
            properties:
              - name: source
                type: string
                title: CryptoPriceSource
                enumValues:
                  - binance
                  - chainlink
                required: true
              - name: symbols
                type: array
                description: >-
                  Trading pair symbols. Binance: lowercase concatenated (e.g.
                  `btcusdt`, `solusdt`, `ethusdt`). Chainlink: slash-separated
                  (e.g. `btc/usd`, `eth/usd`, `sol/usd`). Empty array = all
                  symbols.
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - source
            - symbols
          properties:
            source: &ref_0
              enum:
                - binance
                - chainlink
              title: CryptoPriceSource
              type: string
              x-parser-schema-id: CryptoPriceSource
            symbols:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-98>
              description: >-
                Trading pair symbols. Binance: lowercase concatenated (e.g.
                `btcusdt`, `solusdt`, `ethusdt`). Chainlink: slash-separated
                (e.g. `btc/usd`, `eth/usd`, `sol/usd`). Empty array = all
                symbols.
              x-parser-schema-id: <anonymous-schema-97>
          x-parser-schema-id: <anonymous-schema-96>
        title: Subscribe
        description: Add to the active crypto subscription set
        example: |-
          {
            "source": "binance",
            "symbols": [
              "example"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: crypto_subscribe
    bindings: []
    extensions: &ref_1
      - id: x-parser-unique-object-id
        value: crypto
  - &ref_9
    id: crypto_unsubscribe
    title: Unsubscribe
    description: Remove from the active crypto subscription set
    type: send
    messages:
      - &ref_17
        id: crypto_unsubscribe
        contentType: application/json
        payload:
          - name: Unsubscribe
            description: Remove from the active crypto subscription set
            type: object
            properties:
              - name: source
                type: string
                title: CryptoPriceSource
                enumValues:
                  - binance
                  - chainlink
                required: true
              - name: symbols
                type: array
                description: >-
                  Trading pair symbols. Binance: lowercase concatenated (e.g.
                  `btcusdt`, `solusdt`, `ethusdt`). Chainlink: slash-separated
                  (e.g. `btc/usd`, `eth/usd`, `sol/usd`). Empty array = all
                  symbols.
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - source
            - symbols
          properties:
            source: *ref_0
            symbols:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-101>
              description: >-
                Trading pair symbols. Binance: lowercase concatenated (e.g.
                `btcusdt`, `solusdt`, `ethusdt`). Chainlink: slash-separated
                (e.g. `btc/usd`, `eth/usd`, `sol/usd`). Empty array = all
                symbols.
              x-parser-schema-id: <anonymous-schema-100>
          x-parser-schema-id: <anonymous-schema-99>
        title: Unsubscribe
        description: Remove from the active crypto subscription set
        example: |-
          {
            "source": "binance",
            "symbols": [
              "example"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: crypto_unsubscribe
    bindings: []
    extensions: *ref_1
  - &ref_2
    id: crypto_receive_CryptoPrice
    title: CryptoPrice
    description: Spot price update for a single symbol from `binance` or `chainlink`.
    type: receive
    messages:
      - &ref_10
        id: CryptoPrice
        contentType: application/json
        payload:
          - name: CryptoPrice
            description: >-
              Spot price update for a single symbol from `binance` or
              `chainlink`.
            type: object
            properties:
              - name: source
                type: string
                title: CryptoPriceSource
                enumValues:
                  - binance
                  - chainlink
                required: true
              - name: symbol
                type: string
                required: true
              - name: timestamp
                type: integer
                required: true
              - name: value
                type: number
                required: true
        headers: []
        jsonPayloadSchema:
          properties:
            source: *ref_0
            symbol:
              type: string
              x-parser-schema-id: <anonymous-schema-93>
            timestamp:
              format: uint64
              minimum: 0
              type: integer
              x-parser-schema-id: <anonymous-schema-94>
            value:
              format: double
              type: number
              x-parser-schema-id: <anonymous-schema-95>
          required:
            - source
            - symbol
            - timestamp
            - value
          title: CryptoPrice
          type: object
          x-parser-schema-id: CryptoPrice
        title: Crypto price
        description: Spot price update for a single symbol from `binance` or `chainlink`.
        example: |-
          {
            "source": "binance",
            "symbol": "example",
            "timestamp": 0,
            "value": 0.5
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: CryptoPrice
    bindings: []
    extensions: *ref_1
  - &ref_3
    id: crypto_receive_Connected
    title: Connected
    description: Initial socket establishment.
    type: receive
    messages:
      - &ref_11
        id: Connected
        contentType: application/json
        payload:
          - name: Connected
            description: Initial socket establishment.
            type: object
            properties:
              - name: kind
                type: string
                enumValues:
                  - Connected
                required: true
        headers: []
        jsonPayloadSchema:
          description: Initial socket establishment.
          properties:
            kind:
              enum:
                - Connected
              type: string
              x-parser-schema-id: <anonymous-schema-35>
          required:
            - kind
          type: object
          x-parser-schema-id: Connected
        title: Connected
        description: Initial socket establishment.
        example: |-
          {
            "kind": "Connected"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: Connected
    bindings: []
    extensions: *ref_1
  - &ref_4
    id: crypto_receive_Reconnected
    title: Reconnected
    description: >-
      Socket re-established after an outage — `gap_ms` is the wall-clock
      interval since the last received message.
    type: receive
    messages:
      - &ref_12
        id: Reconnected
        contentType: application/json
        payload:
          - name: Reconnected
            description: >-
              Socket re-established after an outage — `gap_ms` is the wall-clock
              interval since the last received message.
            type: object
            properties:
              - name: gap_ms
                type: integer
                required: true
              - name: kind
                type: string
                enumValues:
                  - Reconnected
                required: true
        headers: []
        jsonPayloadSchema:
          description: >-
            Socket re-established after an outage — `gap_ms` is the wall-clock
            interval since the last received message.
          properties:
            gap_ms:
              format: uint64
              minimum: 0
              type: integer
              x-parser-schema-id: <anonymous-schema-36>
            kind:
              enum:
                - Reconnected
              type: string
              x-parser-schema-id: <anonymous-schema-37>
          required:
            - gap_ms
            - kind
          type: object
          x-parser-schema-id: Reconnected
        title: Reconnected
        description: >-
          Socket re-established after an outage — `gap_ms` is the wall-clock
          interval since the last received message.
        example: |-
          {
            "gap_ms": 0,
            "kind": "Reconnected"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: Reconnected
    bindings: []
    extensions: *ref_1
  - &ref_5
    id: crypto_receive_Lagged
    title: Lagged
    description: >-
      Slow consumer dropped messages — every affected book is invalidated and
      must be rebuilt from the next `Snapshot`.
    type: receive
    messages:
      - &ref_13
        id: Lagged
        contentType: application/json
        payload:
          - name: Lagged
            description: >-
              Slow consumer dropped messages — every affected book is
              invalidated and must be rebuilt from the next `Snapshot`.
            type: object
            properties:
              - name: dropped
                type: integer
                required: true
              - name: first_seq
                type: integer
                required: true
              - name: kind
                type: string
                enumValues:
                  - Lagged
                required: true
              - name: last_seq
                type: integer
                required: true
        headers: []
        jsonPayloadSchema:
          description: >-
            Slow consumer dropped messages — every affected book is invalidated
            and must be rebuilt from the next `Snapshot`.
          properties:
            dropped:
              format: uint64
              minimum: 0
              type: integer
              x-parser-schema-id: <anonymous-schema-38>
            first_seq:
              format: uint64
              minimum: 0
              type: integer
              x-parser-schema-id: <anonymous-schema-39>
            kind:
              enum:
                - Lagged
              type: string
              x-parser-schema-id: <anonymous-schema-40>
            last_seq:
              format: uint64
              minimum: 0
              type: integer
              x-parser-schema-id: <anonymous-schema-41>
          required:
            - dropped
            - first_seq
            - kind
            - last_seq
          type: object
          x-parser-schema-id: Lagged
        title: Lagged
        description: >-
          Slow consumer dropped messages — every affected book is invalidated
          and must be rebuilt from the next `Snapshot`.
        example: |-
          {
            "dropped": 0,
            "first_seq": 0,
            "kind": "Lagged",
            "last_seq": 0
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: Lagged
    bindings: []
    extensions: *ref_1
  - &ref_6
    id: crypto_receive_BookInvalidated
    title: BookInvalidated
    description: >-
      A specific market's book is no longer trustworthy — drop cache and wait
      for next `Snapshot` (reasons: `Reconnect`, `Lag`, `SequenceGap`,
      `ExchangeReset`).
    type: receive
    messages:
      - &ref_14
        id: BookInvalidated
        contentType: application/json
        payload:
          - name: BookInvalidated
            description: >-
              A specific market's book is no longer trustworthy — drop cache and
              wait for next `Snapshot` (reasons: `Reconnect`, `Lag`,
              `SequenceGap`, `ExchangeReset`).
            type: object
            properties:
              - name: kind
                type: string
                enumValues:
                  - BookInvalidated
                required: true
              - name: market_id
                type: string
                required: true
              - name: reason
                type: oneOf
                description: >-
                  Why a specific book was invalidated — handed to users so they
                  can decide whether to alert, log, or handle it silently.
                required: true
                properties:
                  - name: SequenceGap
                    type: object
                    required: true
                    properties:
                      - name: expected
                        type: integer
                        required: true
                      - name: received
                        type: integer
                        required: true
        headers: []
        jsonPayloadSchema:
          description: >-
            A specific market's book is no longer trustworthy — drop cache and
            wait for next `Snapshot` (reasons: `Reconnect`, `Lag`,
            `SequenceGap`, `ExchangeReset`).
          properties:
            kind:
              enum:
                - BookInvalidated
              type: string
              x-parser-schema-id: <anonymous-schema-42>
            market_id:
              type: string
              x-parser-schema-id: <anonymous-schema-43>
            reason:
              description: >-
                Why a specific book was invalidated — handed to users so they
                can decide whether to alert, log, or handle it silently.
              oneOf:
                - enum:
                    - Reconnect
                    - Lag
                    - ExchangeReset
                  type: string
                  x-parser-schema-id: <anonymous-schema-29>
                - additionalProperties: false
                  properties:
                    SequenceGap:
                      properties:
                        expected:
                          format: uint64
                          minimum: 0
                          type: integer
                          x-parser-schema-id: <anonymous-schema-32>
                        received:
                          format: uint64
                          minimum: 0
                          type: integer
                          x-parser-schema-id: <anonymous-schema-33>
                      required:
                        - expected
                        - received
                      type: object
                      x-parser-schema-id: <anonymous-schema-31>
                  required:
                    - SequenceGap
                  type: object
                  x-parser-schema-id: <anonymous-schema-30>
              x-parser-schema-id: InvalidationReason
          required:
            - kind
            - market_id
            - reason
          type: object
          x-parser-schema-id: BookInvalidated
        title: Book invalidated
        description: >-
          A specific market's book is no longer trustworthy — drop cache and
          wait for next `Snapshot` (reasons: `Reconnect`, `Lag`, `SequenceGap`,
          `ExchangeReset`).
        example: |-
          {
            "kind": "BookInvalidated",
            "market_id": "example",
            "reason": null
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: BookInvalidated
    bindings: []
    extensions: *ref_1
  - &ref_7
    id: crypto_receive_Error
    title: Error
    description: A non-fatal error observed on the connection (session continues).
    type: receive
    messages:
      - &ref_15
        id: Error
        contentType: application/json
        payload:
          - name: Error
            description: A non-fatal error observed on the connection (session continues).
            type: object
            properties:
              - name: kind
                type: string
                enumValues:
                  - Error
                required: true
              - name: message
                type: string
                required: true
        headers: []
        jsonPayloadSchema:
          description: A non-fatal error observed on the connection (session continues).
          properties:
            kind:
              enum:
                - Error
              type: string
              x-parser-schema-id: <anonymous-schema-44>
            message:
              type: string
              x-parser-schema-id: <anonymous-schema-45>
          required:
            - kind
            - message
          type: object
          x-parser-schema-id: Error
        title: Error
        description: A non-fatal error observed on the connection (session continues).
        example: |-
          {
            "kind": "Error",
            "message": "example"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: Error
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
  - *ref_3
  - *ref_4
  - *ref_5
  - *ref_6
  - *ref_7
receiveOperations:
  - *ref_8
  - *ref_9
sendMessages:
  - *ref_10
  - *ref_11
  - *ref_12
  - *ref_13
  - *ref_14
  - *ref_15
receiveMessages:
  - *ref_16
  - *ref_17
extensions:
  - id: x-parser-unique-object-id
    value: crypto
securitySchemes: []

````