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

# Arb

> Subscribe to per-market arb-return updates. Send `{ action: "subscribe", channel: "arb", marketIds: string[] }`. The server echos subscribed marketIds in the `subscribed` reply. No initial snapshot — updates arrive as `arb_market_update` messages when the engine detects a change.



## AsyncAPI

````yaml openapi/asyncapi.json arb
id: arb
title: Arb
description: >-
  Subscribe to per-market arb-return updates. Send `{ action: "subscribe",
  channel: "arb", marketIds: string[] }`. The server echos subscribed marketIds
  in the `subscribed` reply. No initial snapshot — updates arrive as
  `arb_market_update` messages when the engine detects a change.
servers:
  - id: production
    protocol: wss
    host: ws.agg.market
    bindings: []
    variables: []
address: /
parameters: []
bindings: []
operations:
  - &ref_2
    id: subscribeArb
    title: Subscribe arb
    description: Subscribe to arb-return updates for specific markets
    type: send
    messages:
      - &ref_5
        id: subscribe
        payload:
          - name: Subscribe to orderbook
            description: Subscribe to aggregated orderbook updates for markets
            type: object
            properties:
              - name: action
                type: string
                description: subscribe
                required: true
              - name: channel
                type: string
                required: true
              - name: outcomeIds
                type: array
                description: Outcome IDs to subscribe to
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          title: Subscribe
          type: object
          required:
            - action
            - channel
            - outcomeIds
          properties:
            action:
              const: subscribe
              type: string
              x-parser-schema-id: <anonymous-schema-2>
            channel:
              anyOf:
                - const: orderbook
                  type: string
                  x-parser-schema-id: <anonymous-schema-4>
                - const: trades
                  type: string
                  x-parser-schema-id: <anonymous-schema-5>
              x-parser-schema-id: <anonymous-schema-3>
            outcomeIds:
              description: Outcome IDs to subscribe to
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-7>
              x-parser-schema-id: <anonymous-schema-6>
          x-parser-schema-id: <anonymous-schema-1>
        title: Subscribe to orderbook
        description: Subscribe to aggregated orderbook updates for markets
        example: |-
          {
            "action": "subscribe",
            "channel": "orderbook",
            "outcomeIds": [
              "clv2abc123def456",
              "clv2xyz789ghi012"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: arb
  - &ref_3
    id: unsubscribeArb
    title: Unsubscribe arb
    description: Unsubscribe from arb-return updates for specific markets
    type: send
    messages:
      - &ref_6
        id: unsubscribe
        payload:
          - name: Unsubscribe from orderbook
            type: object
            properties:
              - name: action
                type: string
                description: unsubscribe
                required: true
              - name: channel
                type: string
                required: true
              - name: outcomeIds
                type: array
                description: Outcome IDs to unsubscribe from
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          title: Unsubscribe
          type: object
          required:
            - action
            - channel
            - outcomeIds
          properties:
            action:
              const: unsubscribe
              type: string
              x-parser-schema-id: <anonymous-schema-9>
            channel:
              anyOf:
                - const: orderbook
                  type: string
                  x-parser-schema-id: <anonymous-schema-11>
                - const: trades
                  type: string
                  x-parser-schema-id: <anonymous-schema-12>
              x-parser-schema-id: <anonymous-schema-10>
            outcomeIds:
              description: Outcome IDs to unsubscribe from
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-14>
              x-parser-schema-id: <anonymous-schema-13>
          x-parser-schema-id: <anonymous-schema-8>
        title: Unsubscribe from orderbook
        example: |-
          {
            "action": "unsubscribe",
            "channel": "orderbook",
            "outcomeIds": [
              "clv2abc123def456",
              "clv2xyz789ghi012"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribe
    bindings: []
    extensions: *ref_0
  - &ref_1
    id: receiveArbMarketUpdate
    title: Receive arb market update
    description: Arb-return update for a subscribed market
    type: receive
    messages:
      - &ref_4
        id: arbMarketUpdate
        payload:
          - name: Arb-return update for a specific market
            description: >-
              Pushed to clients subscribed to { channel: "arb", marketIds } when
              the engine detects a new arbReturn value for that market.
            type: object
            properties:
              - name: type
                type: string
                description: arb_market_update
                required: true
              - name: marketId
                type: string
                required: true
              - name: activeVenuesOnly
                type: boolean
                description: Producer assertion that globally inactive venues were excluded
                required: true
              - name: venueEventId
                type: string
                required: true
              - name: arbReturn
                type: number
                required: true
              - name: ts
                type: number
                required: true
              - name: liquidityUsd
                type: number
                required: false
              - name: liquidityTier
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          title: ArbMarketUpdate
          type: object
          required:
            - type
            - marketId
            - activeVenuesOnly
            - venueEventId
            - arbReturn
            - ts
          properties:
            type:
              const: arb_market_update
              type: string
              x-parser-schema-id: <anonymous-schema-239>
            marketId:
              type: string
              x-parser-schema-id: <anonymous-schema-240>
            activeVenuesOnly:
              description: Producer assertion that globally inactive venues were excluded
              const: true
              type: boolean
              x-parser-schema-id: <anonymous-schema-241>
            venueEventId:
              anyOf:
                - type: string
                  x-parser-schema-id: <anonymous-schema-243>
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-244>
              x-parser-schema-id: <anonymous-schema-242>
            arbReturn:
              type: number
              x-parser-schema-id: <anonymous-schema-245>
            ts:
              type: number
              x-parser-schema-id: <anonymous-schema-246>
            liquidityUsd:
              type: number
              x-parser-schema-id: <anonymous-schema-247>
            liquidityTier:
              anyOf:
                - const: deep
                  type: string
                  x-parser-schema-id: <anonymous-schema-249>
                - const: shallow
                  type: string
                  x-parser-schema-id: <anonymous-schema-250>
              x-parser-schema-id: <anonymous-schema-248>
          x-parser-schema-id: <anonymous-schema-238>
        title: Arb-return update for a specific market
        description: >-
          Pushed to clients subscribed to { channel: "arb", marketIds } when the
          engine detects a new arbReturn value for that market.
        example: |-
          {
            "type": "arb_market_update",
            "marketId": "mkt_abc123",
            "activeVenuesOnly": true,
            "venueEventId": "evt_xyz789",
            "arbReturn": 0.05,
            "ts": 1710000000000,
            "liquidityUsd": 0,
            "liquidityTier": "deep"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: arbMarketUpdate
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
  - *ref_6
extensions:
  - id: x-parser-unique-object-id
    value: arb
securitySchemes:
  - id: appId
    name: appId
    type: userPassword
    description: >-
      App-level auth: pass appId as a query parameter on connect. Required for
      all connections. The appId must belong to an active app with matching
      allowed origins.
    extensions: []
  - id: jwt
    name: jwt
    type: http
    description: >-
      User-level auth: pass JWT as token query param on connect, or send {
      action: 'authenticate', token } mid-session. Required for user-specific
      events (orders, balances). Same JWT as the REST API.
    scheme: bearer
    bearerFormat: JWT
    extensions: []

````