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

# Market depth

> Market order book depth with aggregated price levels. Optional aggregationLevel parameter (1, 2, 5, 10, 100, or 1000) can be appended to the topic, defaults to 1 if not specified.



## AsyncAPI

````yaml api-reference/asyncapi.json marketDepth
id: marketDepth
title: Market depth
description: >-
  Market order book depth with aggregated price levels. Optional
  aggregationLevel parameter (1, 2, 5, 10, 100, or 1000) can be appended to the
  topic, defaults to 1 if not specified.
servers:
  - id: testnet
    protocol: wss
    host: api.testnet.aptoslabs.com/decibel/ws
    bindings: []
    variables: []
address: depth:{marketAddr}:{aggregationLevel}
parameters:
  - id: marketAddr
    jsonSchema:
      type: string
      description: Market address (Aptos address format, e.g. 0x456...)
    description: Market address (Aptos address format, e.g. 0x456...)
    type: string
    required: true
    deprecated: false
  - id: aggregationLevel
    jsonSchema:
      type: string
      description: Price aggregation level for order book depth (1, 2, 5, 10, 100, or 1000)
    description: Price aggregation level for order book depth (1, 2, 5, 10, 100, or 1000)
    type: string
    required: true
    deprecated: false
bindings: []
operations:
  - &ref_3
    id: receivemarketDepth
    title: Receivemarket depth
    description: >-
      Receive updates for market order book depth with aggregated price levels.
      optional aggregationlevel parameter (1, 2, 5, 10, 100, or 1000) can be
      appended to the topic, defaults to 1 if not specified.
    type: receive
    messages:
      - &ref_4
        id: MarketDepthMessage
        payload:
          - name: MarketDepthMessage
            description: >-
              Market order book depth with aggregated price levels. Optional
              aggregationLevel parameter (1, 2, 5, 10, 100, or 1000) can be
              appended to the topic, defaults to 1 if not specified.
            type: object
            properties:
              - name: asks
                type: array
                required: true
                properties:
                  - name: price
                    type: number
                    required: true
                  - name: size
                    type: number
                    required: true
              - name: best_ask
                type: &ref_0
                  - number
                  - 'null'
                description: >-
                  True best ask price (pre-aggregation), useful for accurate
                  spread calculation at higher aggregation levels
                required: false
              - name: best_bid
                type: &ref_1
                  - number
                  - 'null'
                description: >-
                  True best bid price (pre-aggregation), useful for accurate
                  spread calculation at higher aggregation levels
                required: false
              - name: bids
                type: array
                required: true
                properties:
                  - name: price
                    type: number
                    required: true
                  - name: size
                    type: number
                    required: true
              - name: market
                type: string
                required: true
              - name: topic
                type: string
                required: true
              - name: unix_ms
                type: integer
                description: Latest transaction timestamp in milliseconds
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - topic
            - market
            - bids
            - asks
            - unix_ms
          properties:
            asks:
              type: array
              items: &ref_2
                type: object
                required:
                  - price
                  - size
                properties:
                  price:
                    type: number
                    format: double
                    x-parser-schema-id: <anonymous-schema-51>
                  size:
                    type: number
                    format: double
                    x-parser-schema-id: <anonymous-schema-52>
                x-parser-schema-id: NormalizedPriceLevel
              x-parser-schema-id: <anonymous-schema-50>
            best_ask:
              type: *ref_0
              format: double
              description: >-
                True best ask price (pre-aggregation), useful for accurate
                spread calculation at higher aggregation levels
              x-parser-schema-id: <anonymous-schema-53>
            best_bid:
              type: *ref_1
              format: double
              description: >-
                True best bid price (pre-aggregation), useful for accurate
                spread calculation at higher aggregation levels
              x-parser-schema-id: <anonymous-schema-54>
            bids:
              type: array
              items: *ref_2
              x-parser-schema-id: <anonymous-schema-55>
            market:
              type: string
              x-parser-schema-id: <anonymous-schema-56>
            topic:
              type: string
              x-parser-schema-id: <anonymous-schema-57>
            unix_ms:
              type: integer
              format: int64
              description: Latest transaction timestamp in milliseconds
              x-parser-schema-id: <anonymous-schema-58>
          x-parser-schema-id: MarketDepthResponse
        title: Market depth message
        description: >-
          Market order book depth with aggregated price levels. Optional
          aggregationLevel parameter (1, 2, 5, 10, 100, or 1000) can be appended
          to the topic, defaults to 1 if not specified.
        example: |-
          {
            "topic": "depth:0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890:1",
            "market": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
            "bids": [
              {
                "price": 50000,
                "size": 10.5
              },
              {
                "price": 49950,
                "size": 15.2
              },
              {
                "price": 49900,
                "size": 20
              }
            ],
            "asks": [
              {
                "price": 50050,
                "size": 8.3
              },
              {
                "price": 50100,
                "size": 12.7
              },
              {
                "price": 50150,
                "size": 18.5
              }
            ],
            "unix_ms": 1699564800000,
            "best_bid": 50000,
            "best_ask": 50050
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: MarketDepthMessage
          - id: x-parser-message-name
            value: MarketDepthMessage
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: marketDepth
sendOperations:
  - *ref_3
receiveOperations: []
sendMessages:
  - *ref_4
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: marketDepth
securitySchemes: []

````