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

# Độ sâu thị trường

> Cung cấp thông tin giá chào mua và chào bán tốt nhất của mã chứng khoán tại bảng giao dịch cụ thể,
cập nhật theo thời gian thực trong phiên giao dịch.

- Sàn HOSE hỗ trợ 3 mức giá.
- Sàn HNX, UPCOM hỗ trợ 10 mức giá.



## AsyncAPI

````yaml vi/asyncapi/dnse.2026-09-10.asyncapi.yaml quoteStream
id: quoteStream
title: Độ sâu thị trường
description: >-
  Cung cấp thông tin giá chào mua và chào bán tốt nhất của mã chứng khoán tại
  bảng giao dịch cụ thể,

  cập nhật theo thời gian thực trong phiên giao dịch.


  - Sàn HOSE hỗ trợ 3 mức giá.

  - Sàn HNX, UPCOM hỗ trợ 10 mức giá.
servers:
  - id: production
    protocol: wss
    host: ws-openapi.dnse.com.vn
    bindings: []
    variables: []
  - id: sanbox
    protocol: wss
    host: ws-sb-openapi.dnse.com.vn
    bindings: []
    variables: []
address: /v1/stream
parameters: []
bindings:
  - protocol: ws
    version: 0.1.0
    value:
      method: GET
      query:
        type: object
        additionalProperties: false
        required:
          - encoding
        properties:
          encoding:
            type: string
            const: json
            default: json
            description: Định dạng mã hóa dữ liệu WebSocket (`json`, `msgpack`).
    schemaProperties:
      - name: method
        type: string
        description: GET
        required: false
      - name: query
        type: object
        required: false
        properties:
          - name: encoding
            type: string
            description: Định dạng mã hóa dữ liệu WebSocket (`json`, `msgpack`).
            required: true
operations:
  - &ref_1
    id: onQuoteSubscription
    title: Đăng ký luồng độ sâu thị trường
    type: receive
    messages:
      - &ref_3
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Đăng ký luồng độ sâu thị trường
            description: Đăng ký topic `top_price.{market_group}.{encoding}`.
            type: object
            properties:
              - name: action
                type: string
                description: subscribe
                required: true
              - name: channels
                type: array
                required: true
                properties:
                  - name: name
                    type: string
                    description: Topic độ sâu thị trường theo nhóm thị trường.
                    required: true
                  - name: symbols
                    type: array
                    required: true
                    properties:
                      - name: item
                        type: string
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - action
            - channels
          properties:
            action:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-129>
            channels:
              type: array
              minItems: 1
              uniqueItems: true
              items:
                type: object
                additionalProperties: false
                required:
                  - name
                  - symbols
                properties:
                  name:
                    type: string
                    description: Topic độ sâu thị trường theo nhóm thị trường.
                    pattern: ^top_price\.[A-Z0-9]+\.json$
                    x-parser-schema-id: <anonymous-schema-132>
                  symbols:
                    type: array
                    minItems: 1
                    uniqueItems: true
                    items:
                      type: string
                      minLength: 1
                      x-parser-schema-id: <anonymous-schema-134>
                    x-parser-schema-id: <anonymous-schema-133>
                x-parser-schema-id: <anonymous-schema-131>
              x-parser-schema-id: <anonymous-schema-130>
          x-parser-schema-id: <anonymous-schema-128>
        title: Đăng ký luồng độ sâu thị trường
        description: Đăng ký topic `top_price.{market_group}.{encoding}`.
        example: |-
          {
            "action": "subscribe",
            "channels": [
              {
                "name": "top_price.G1.json",
                "symbols": [
                  "HPG"
                ]
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: quoteStream
  - &ref_2
    id: onQuoteUpdates
    title: Nhận cập nhật độ sâu thị trường
    type: send
    messages:
      - &ref_4
        id: update
        contentType: application/json
        payload:
          - name: Cập nhật độ sâu thị trường
            description: Bản cập nhật các mức giá mua và bán tốt nhất.
            type: object
            properties:
              - name: T
                type: string
                description: Mã loại message độ sâu thị trường.
                required: true
              - name: symbol
                type: string
                description: Mã chứng khoán.
                required: true
              - name: marketId
                type: string
                description: Mã thị trường niêm yết mã chứng khoán.
                required: true
              - name: boardId
                type: string
                description: Mã bảng giao dịch.
                required: true
              - name: isin
                type: string
                description: Mã định danh quốc tế (ISIN) của chứng khoán.
                required: true
              - name: bid
                type: array
                description: Danh sách các mức giá chào mua tốt nhất.
                required: true
                properties:
                  - name: price
                    type: number
                    description: Giá chào mua hoặc chào bán tại mức giá này.
                    required: true
                  - name: qtty
                    type: number
                    description: Tổng khối lượng chào mua hoặc chào bán tại mức giá này.
                    required: true
              - name: offer
                type: array
                description: Danh sách các mức giá chào bán tốt nhất.
                required: true
                properties:
                  - name: price
                    type: number
                    description: Giá chào mua hoặc chào bán tại mức giá này.
                    required: true
                  - name: qtty
                    type: number
                    description: Tổng khối lượng chào mua hoặc chào bán tại mức giá này.
                    required: true
              - name: totalOfferQtty
                type: number
                description: Tổng khối lượng chào bán.
                required: true
              - name: totalBidQtty
                type: number
                description: Tổng khối lượng chào mua.
                required: true
              - name: multicastReceiveTime
                type: object
                description: Thời gian nhận message qua multicast.
                required: true
                properties:
                  - name: Seconds
                    type: integer
                    description: Unix timestamp tính bằng giây.
                    required: true
                  - name: Nanos
                    type: integer
                    description: Phần nanosecond của timestamp.
                    required: true
              - name: time
                type: object
                description: Thời gian trong các message giá của sàn trả về.
                required: true
                properties:
                  - name: Seconds
                    type: integer
                    description: Unix timestamp tính bằng giây.
                    required: true
                  - name: Nanos
                    type: integer
                    description: Phần nanosecond của timestamp.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: Dữ liệu các mức giá mua và bán tốt nhất trên thị trường.
          required:
            - T
            - symbol
            - bid
            - offer
            - marketId
            - boardId
            - isin
            - totalOfferQtty
            - totalBidQtty
            - multicastReceiveTime
            - time
          properties:
            T:
              type: string
              description: Mã loại message độ sâu thị trường.
              const: q
              x-parser-schema-id: <anonymous-schema-136>
            symbol:
              type: string
              description: Mã chứng khoán.
              x-parser-schema-id: <anonymous-schema-137>
            marketId:
              type: string
              description: Mã thị trường niêm yết mã chứng khoán.
              x-parser-schema-id: <anonymous-schema-138>
            boardId:
              type: string
              description: Mã bảng giao dịch.
              x-parser-schema-id: <anonymous-schema-139>
            isin:
              type: string
              description: Mã định danh quốc tế (ISIN) của chứng khoán.
              x-parser-schema-id: <anonymous-schema-140>
            bid:
              description: Danh sách các mức giá chào mua tốt nhất.
              type: array
              items:
                type: object
                required:
                  - price
                  - qtty
                properties:
                  price:
                    type: number
                    description: Giá chào mua hoặc chào bán tại mức giá này.
                    x-parser-schema-id: <anonymous-schema-143>
                  qtty:
                    type: number
                    description: Tổng khối lượng chào mua hoặc chào bán tại mức giá này.
                    x-parser-schema-id: <anonymous-schema-144>
                x-parser-schema-id: <anonymous-schema-142>
              x-parser-schema-id: <anonymous-schema-141>
            offer:
              description: Danh sách các mức giá chào bán tốt nhất.
              type: array
              items:
                type: object
                required:
                  - price
                  - qtty
                properties:
                  price:
                    type: number
                    description: Giá chào mua hoặc chào bán tại mức giá này.
                    x-parser-schema-id: <anonymous-schema-147>
                  qtty:
                    type: number
                    description: Tổng khối lượng chào mua hoặc chào bán tại mức giá này.
                    x-parser-schema-id: <anonymous-schema-148>
                x-parser-schema-id: <anonymous-schema-146>
              x-parser-schema-id: <anonymous-schema-145>
            totalOfferQtty:
              type: number
              description: Tổng khối lượng chào bán.
              x-parser-schema-id: <anonymous-schema-149>
            totalBidQtty:
              type: number
              description: Tổng khối lượng chào mua.
              x-parser-schema-id: <anonymous-schema-150>
            multicastReceiveTime:
              type: object
              description: Thời gian nhận message qua multicast.
              required:
                - Seconds
                - Nanos
              properties:
                Seconds:
                  type: integer
                  format: int64
                  description: Unix timestamp tính bằng giây.
                  x-parser-schema-id: <anonymous-schema-152>
                Nanos:
                  type: integer
                  format: int32
                  description: Phần nanosecond của timestamp.
                  x-parser-schema-id: <anonymous-schema-153>
              x-parser-schema-id: <anonymous-schema-151>
            time:
              type: object
              description: Thời gian trong các message giá của sàn trả về.
              required:
                - Seconds
                - Nanos
              properties:
                Seconds:
                  type: integer
                  format: int64
                  description: Unix timestamp tính bằng giây.
                  x-parser-schema-id: <anonymous-schema-155>
                Nanos:
                  type: integer
                  format: int32
                  description: Phần nanosecond của timestamp.
                  x-parser-schema-id: <anonymous-schema-156>
              x-parser-schema-id: <anonymous-schema-154>
          x-parser-schema-id: <anonymous-schema-135>
        title: Cập nhật độ sâu thị trường
        description: Bản cập nhật các mức giá mua và bán tốt nhất.
        example: |-
          {
            "T": "q",
            "bid": [
              {
                "price": 21,
                "qtty": 14590
              },
              {
                "price": 20.95,
                "qtty": 69990
              },
              {
                "price": 20.9,
                "qtty": 121890
              }
            ],
            "boardId": "G1",
            "isin": "VN000000HPG4",
            "marketId": "STO",
            "multicastReceiveTime": {
              "Nanos": 526432284,
              "Seconds": 1787121724
            },
            "offer": [
              {
                "price": 21.05,
                "qtty": 28710
              },
              {
                "price": 21.1,
                "qtty": 13160
              },
              {
                "price": 21.15,
                "qtty": 34890
              }
            ],
            "symbol": "HPG",
            "time": {
              "Nanos": 891000000,
              "Seconds": 1787121726
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: update
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
sendMessages:
  - *ref_3
receiveMessages:
  - *ref_4
extensions:
  - id: x-parser-unique-object-id
    value: quoteStream
securitySchemes: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.