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

# Orderbook

> Channel name: `orderbook.{instrument_name}.{group}.{depth}`. Public channel that periodically publishes aggregated bids and asks for a single instrument, where {instrument_name} is the market (e.g. ETH-PERP), {group} is the price-level aggregation size (1, 10, or 100), and {depth} is the number of levels returned per side (1, 10, 20, or 100).



## AsyncAPI

````yaml subscriptions.asyncapi.json orderbook
id: orderbook
title: Orderbook
description: >-
  Channel name: `orderbook.{instrument_name}.{group}.{depth}`. Public channel
  that periodically publishes aggregated bids and asks for a single instrument,
  where {instrument_name} is the market (e.g. ETH-PERP), {group} is the
  price-level aggregation size (1, 10, or 100), and {depth} is the number of
  levels returned per side (1, 10, 20, or 100).
servers:
  - id: production
    protocol: wss
    host: api.derive.xyz
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: testnet.api.derive.xyz
    bindings: []
    variables: []
address: /v3/ws
parameters: []
bindings: []
operations:
  - &ref_7
    id: receive_orderbook
    title: Receive_orderbook
    type: send
    messages:
      - &ref_10
        id: orderbookNotification
        payload:
          - name: orderbookNotification
            type: object
            properties:
              - name: asks
                type: array
                required: true
                properties:
                  - name: amount
                    type: string
                    required: true
                  - name: price
                    type: string
                    required: true
              - name: bids
                type: array
                required: true
                properties:
                  - name: amount
                    type: string
                    required: true
                  - name: price
                    type: string
                    required: true
              - name: instrument_name
                type: string
                required: true
              - name: publish_id
                type: integer
                required: true
              - name: timestamp
                type: integer
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - asks
            - bids
            - instrument_name
            - publish_id
            - timestamp
          properties:
            asks:
              type: array
              items: &ref_0
                type: object
                required:
                  - amount
                  - price
                properties:
                  amount:
                    type: string
                    x-parser-schema-id: <anonymous-schema-38>
                  price:
                    type: string
                    x-parser-schema-id: <anonymous-schema-39>
                x-parser-schema-id: OrderSnapshot
              x-parser-schema-id: <anonymous-schema-37>
            bids:
              type: array
              items: *ref_0
              x-parser-schema-id: <anonymous-schema-40>
            instrument_name:
              type: string
              x-parser-schema-id: <anonymous-schema-41>
            publish_id:
              type: integer
              format: uint64
              minimum: 0
              x-parser-schema-id: <anonymous-schema-42>
            timestamp:
              type: integer
              format: int64
              x-parser-schema-id: <anonymous-schema-43>
          x-parser-schema-id: OrderbookSnapshot
        title: Orderbook notification
        example: |-
          {
            "asks": {
              "amount": "<string>",
              "price": "<string>"
            },
            "bids": {
              "amount": "<string>",
              "price": "<string>"
            },
            "instrument_name": "<string>",
            "publish_id": 123,
            "timestamp": 123
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: orderbookNotification
    bindings: []
    extensions: &ref_5
      - id: x-parser-unique-object-id
        value: orderbook
  - &ref_6
    id: send_subscribe_orderbook
    title: Send_subscribe_orderbook
    type: receive
    messages:
      - &ref_8
        id: subscribeRequest
        payload:
          - name: subscribeRequest
            description: >-
              Send to subscribe: list this channel's address (with the {param}
              segments filled, e.g. orderbook.ETH-PERP.10.20) in
              params.channels.
            type: object
            properties:
              - name: headers
                type: &ref_1
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: subscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `subscribe`. `channels` is the required list of
                  channel names to subscribe to.
                required: true
                properties:
                  - name: channels
                    type: array
                    required: true
                    properties:
                      - name: item
                        type: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_1
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-16>
            id: &ref_3
              anyOf:
                - type: string
                  x-parser-schema-id: <anonymous-schema-17>
                - type: number
                  x-parser-schema-id: <anonymous-schema-18>
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-19>
              x-parser-schema-id: JsonRpcId
            method:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-20>
            params:
              description: >-
                Params for `subscribe`. `channels` is the required list of
                channel names to subscribe to.
              type: object
              required:
                - channels
              properties:
                channels:
                  type: array
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-22>
                  x-parser-schema-id: <anonymous-schema-21>
              x-parser-schema-id: SubscribeParams
          x-parser-schema-id: <anonymous-schema-15>
        title: Subscribe request
        description: >-
          Send to subscribe: list this channel's address (with the {param}
          segments filled, e.g. orderbook.ETH-PERP.10.20) in params.channels.
        example: |-
          {
            "id": 1,
            "method": "subscribe",
            "params": {
              "channels": [
                "orderbook.ETH-PERP.10.20"
              ]
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
      - &ref_9
        id: unsubscribeRequest
        payload:
          - name: unsubscribeRequest
            description: >-
              Send to unsubscribe: list the channel addresses to drop in
              params.channels, or omit it to unsubscribe from everything.
            type: object
            properties:
              - name: headers
                type: &ref_2
                  - object
                  - 'null'
                description: Non-standard; used by `auth/login`.
                required: false
              - name: id
                type: anyOf
                required: true
              - name: method
                type: string
                description: unsubscribe
                required: true
              - name: params
                type: object
                description: >-
                  Params for `unsubscribe`. `channels` is optional.


                  When omitted (or null) the connection unsubscribes from all
                  channels.
                required: true
                properties:
                  - name: channels
                    type: &ref_4
                      - array
                      - 'null'
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - id
            - method
            - params
          properties:
            headers:
              description: Non-standard; used by `auth/login`.
              type: *ref_2
              additionalProperties: true
              x-parser-schema-id: <anonymous-schema-24>
            id: *ref_3
            method:
              type: string
              const: unsubscribe
              x-parser-schema-id: <anonymous-schema-25>
            params:
              description: >-
                Params for `unsubscribe`. `channels` is optional.


                When omitted (or null) the connection unsubscribes from all
                channels.
              type: object
              properties:
                channels:
                  default: null
                  type: *ref_4
                  items:
                    type: string
                    x-parser-schema-id: <anonymous-schema-27>
                  x-parser-schema-id: <anonymous-schema-26>
              x-parser-schema-id: UnsubscribeParams
          x-parser-schema-id: <anonymous-schema-23>
        title: Unsubscribe request
        description: >-
          Send to unsubscribe: list the channel addresses to drop in
          params.channels, or omit it to unsubscribe from everything.
        example: |-
          {
            "method": "<string>",
            "params": {}
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_5
sendOperations:
  - *ref_6
receiveOperations:
  - *ref_7
sendMessages:
  - *ref_8
  - *ref_9
receiveMessages:
  - *ref_10
extensions:
  - id: x-parser-unique-object-id
    value: orderbook
securitySchemes: []

````

## Related topics

- [Orderbook Trading](/trading/order-types.md)
- [Place a new order](/api-reference/orderbook/place-a-new-order.md)
- [Cancel an existing order and place a new one](/api-reference/orderbook/cancel-an-existing-order-and-place-a-new-one.md)
