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

# L2 orderbook

> > **Endpoint:** `wss://api.testnet.arcus.xyz/v1/ws` — one socket multiplexes every channel and RPC request. Click **Connect**, then send the example subscribe message below to start receiving data.

Periodic full L2 orderbook snapshots for a single market. On subscribe, the server sends the current book up to `nLevels` price levels per side, then continues to broadcast a fresh full snapshot every ~500ms.

No incremental updates — each message replaces the prior book state. Use `l2OrderbookUpdates` if you need to maintain your own local book.




## AsyncAPI

````yaml api-reference/asyncapi.yaml l2Orderbook
id: l2Orderbook
title: L2 orderbook
description: >
  > **Endpoint:** `wss://api.testnet.arcus.xyz/v1/ws` — one socket multiplexes
  every channel and RPC request. Click **Connect**, then send the example
  subscribe message below to start receiving data.


  Periodic full L2 orderbook snapshots for a single market. On subscribe, the
  server sends the current book up to `nLevels` price levels per side, then
  continues to broadcast a fresh full snapshot every ~500ms.


  No incremental updates — each message replaces the prior book state. Use
  `l2OrderbookUpdates` if you need to maintain your own local book.
servers:
  - id: testnet
    protocol: wss
    host: api.testnet.arcus.xyz
    bindings: []
    variables: []
  - id: mainnet
    protocol: wss
    host: api.arcus.xyz
    bindings: []
    variables: []
address: /v1/ws?channel=l2Orderbook
parameters: []
bindings: []
operations:
  - &ref_2
    id: subscribeL2Orderbook
    title: Subscribe l2 orderbook
    type: receive
    messages:
      - &ref_4
        id: subscribe
        contentType: application/json
        payload:
          - name: Subscribe to L2 Orderbook
            type: object
            properties:
              - name: type
                type: string
                description: subscribe
                required: true
              - name: channel
                type: string
                enumValues:
                  - l2Orderbook
                  - l2OrderbookUpdates
                required: true
              - name: id
                type: string
                description: Market display name (e.g. "BTC-USD", "ETH-USD").
                required: true
              - name: nLevels
                type: integer
                description: Price levels per side in snapshot. Range 1–100.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - channel
            - id
          properties:
            type:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-1>
            channel:
              type: string
              enum:
                - l2Orderbook
                - l2OrderbookUpdates
              x-parser-schema-id: <anonymous-schema-2>
            id:
              type: string
              description: Market display name (e.g. "BTC-USD", "ETH-USD").
              example: BTC-USD
              x-parser-schema-id: <anonymous-schema-3>
            nLevels:
              type: integer
              description: Price levels per side in snapshot. Range 1–100.
              default: 20
              minimum: 1
              maximum: 100
              x-parser-schema-id: <anonymous-schema-4>
          x-parser-schema-id: SubscribeL2OrderbookPayload
        title: Subscribe to L2 Orderbook
        example: |-
          {
            "type": "subscribe",
            "channel": "l2Orderbook",
            "id": "BTC-USD",
            "nLevels": 50
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
    bindings: []
    extensions: &ref_1
      - id: x-parser-unique-object-id
        value: l2Orderbook
  - &ref_3
    id: receiveL2Orderbook
    title: Receive l2 orderbook
    type: send
    messages:
      - &ref_5
        id: snapshot
        contentType: application/json
        payload:
          - allOf: &ref_0
              - type: object
                description: Common envelope for all server-pushed channel messages.
                required:
                  - type
                  - channel
                properties:
                  type:
                    type: string
                    enum:
                      - subscribed
                      - channel_data
                    description: >-
                      `subscribed` for the initial snapshot; `channel_data` for
                      updates.
                    x-parser-schema-id: <anonymous-schema-5>
                  channel:
                    type: string
                    description: Channel name.
                    x-parser-schema-id: <anonymous-schema-6>
                  id:
                    type: string
                    description: >-
                      Channel id (market or address). Absent for global
                      channels.
                    x-parser-schema-id: <anonymous-schema-7>
                  contents:
                    type: object
                    additionalProperties: true
                    description: Channel-specific payload. Schema varies by channel.
                    properties: {}
                    x-parser-schema-id: <anonymous-schema-8>
                x-parser-schema-id: ChannelDataEnvelope
              - type: object
                properties:
                  type:
                    const: subscribed
                    x-parser-schema-id: <anonymous-schema-10>
                  contents:
                    type: object
                    required:
                      - bids
                      - asks
                      - lastSequenceId
                    properties:
                      bids:
                        type: array
                        description: >-
                          Price levels, best bid first. Each entry is `[price,
                          size]`.
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: string
                            x-parser-schema-id: <anonymous-schema-14>
                          x-parser-schema-id: <anonymous-schema-13>
                        example:
                          - - '94500.0'
                            - '1.5'
                          - - '94499.0'
                            - '2.0'
                        x-parser-schema-id: <anonymous-schema-12>
                      asks:
                        type: array
                        description: >-
                          Price levels, best ask first. Each entry is `[price,
                          size]`.
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: string
                            x-parser-schema-id: <anonymous-schema-17>
                          x-parser-schema-id: <anonymous-schema-16>
                        example:
                          - - '94501.0'
                            - '0.8'
                          - - '94502.0'
                            - '3.1'
                        x-parser-schema-id: <anonymous-schema-15>
                      lastSequenceId:
                        type: integer
                        description: >-
                          Per-market orderbook sequence of the last update
                          reflected in this snapshot. Reconcile
                          `l2OrderbookUpdates` deltas against this — apply
                          deltas whose `lastSequenceId` exceeds it.
                        example: 1042
                        x-parser-schema-id: <anonymous-schema-18>
                      globalSequenceId:
                        type: integer
                        description: Cross-market monotonic sequence. Omitted when zero.
                        example: 880421
                        x-parser-schema-id: <anonymous-schema-19>
                      timestamp:
                        type: integer
                        format: int64
                        description: >-
                          Unix microseconds when the snapshot was taken. Omitted
                          when zero.
                        example: 1780410803123456
                        x-parser-schema-id: <anonymous-schema-20>
                    x-parser-schema-id: <anonymous-schema-11>
                x-parser-schema-id: <anonymous-schema-9>
            x-parser-schema-id: L2OrderbookSnapshotPayload
            name: L2 Orderbook Snapshot
        headers: []
        jsonPayloadSchema:
          allOf: *ref_0
          x-parser-schema-id: L2OrderbookSnapshotPayload
        title: L2 Orderbook Snapshot
        example: |-
          {
            "type": "subscribed",
            "channel": "l2Orderbook",
            "id": "BTC-USD",
            "contents": {
              "bids": [
                [
                  "94500.0",
                  "1.5"
                ],
                [
                  "94499.0",
                  "2.0"
                ]
              ],
              "asks": [
                [
                  "94501.0",
                  "0.8"
                ],
                [
                  "94502.0",
                  "3.1"
                ]
              ],
              "lastSequenceId": 1042,
              "globalSequenceId": 880421,
              "timestamp": 1780410803123456
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: snapshot
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
extensions:
  - id: x-parser-unique-object-id
    value: l2Orderbook
securitySchemes: []

````