> ## 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.

# Nến (OHLC) đang hình thành

> OHLC cung cấp thông tin nến (open, high, low, close, volume) theo khung thời gian thực dưới dạng dữ liệu nến đang hình thành 
và được cập nhật liên tục theo các giao dịch phát sinh. Áp dụng cho Cổ phiếu (stock), 
Phái sinh (derivative) và Chỉ số thị trường (index) với nhiều khung thời gian (resolution).



## AsyncAPI

````yaml vi/asyncapi/dnse.2026-09-10.asyncapi.yaml ohlcStream
id: ohlcStream
title: Nến (OHLC) đang hình thành
description: >-
  OHLC cung cấp thông tin nến (open, high, low, close, volume) theo khung thời
  gian thực dưới dạng dữ liệu nến đang hình thành 

  và được cập nhật liên tục theo các giao dịch phát sinh. Áp dụng cho Cổ phiếu
  (stock), 

  Phái sinh (derivative) và Chỉ số thị trường (index) với nhiều khung thời gian
  (resolution).
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: onOhlcSubscription
    title: Đăng ký luồng nến đang hình thành
    type: receive
    messages:
      - &ref_3
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Đăng ký luồng nến đang hình thành
            description: Đăng ký topic `ohlc.{resolution}.{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 nến đang hình thành theo độ phân giải.
                    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-177>
            channels:
              type: array
              minItems: 1
              uniqueItems: true
              items:
                type: object
                additionalProperties: false
                required:
                  - name
                  - symbols
                properties:
                  name:
                    type: string
                    description: Topic nến đang hình thành theo độ phân giải.
                    pattern: ^ohlc\.[0-9]+\.json$
                    x-parser-schema-id: <anonymous-schema-180>
                  symbols:
                    type: array
                    minItems: 1
                    uniqueItems: true
                    items:
                      type: string
                      minLength: 1
                      x-parser-schema-id: <anonymous-schema-182>
                    x-parser-schema-id: <anonymous-schema-181>
                x-parser-schema-id: <anonymous-schema-179>
              x-parser-schema-id: <anonymous-schema-178>
          x-parser-schema-id: <anonymous-schema-176>
        title: Đăng ký luồng nến đang hình thành
        description: Đăng ký topic `ohlc.{resolution}.{encoding}`.
        example: |-
          {
            "action": "subscribe",
            "channels": [
              {
                "name": "ohlc.1.json",
                "symbols": [
                  "HPG"
                ]
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: ohlcStream
  - &ref_2
    id: onOhlcUpdates
    title: Nhận cập nhật nến đang hình thành
    type: send
    messages:
      - &ref_4
        id: update
        contentType: application/json
        payload:
          - name: Cập nhật nến đang hình thành
            description: Bản cập nhật OHLC của nến hiện tại.
            type: object
            properties:
              - name: T
                type: string
                description: Mã loại message OHLC đang hình thành.
                required: true
              - name: symbol
                type: string
                description: Mã chứng khoán hoặc chỉ số.
                required: true
              - name: type
                type: string
                description: Loại nhóm thị trường, ví dụ STOCK, DERIVATIVE hoặc INDEX.
                required: true
              - name: resolution
                type: string
                description: Khung thời gian nến.
                required: true
              - name: open
                type: number
                description: Giá mở cửa.
                required: true
              - name: high
                type: number
                description: Giá cao nhất trong nến.
                required: true
              - name: low
                type: number
                description: Giá thấp nhất trong nến.
                required: true
              - name: close
                type: number
                description: Giá đóng cửa.
                required: true
              - name: volume
                type: integer
                description: Khối lượng giao dịch.
                required: true
              - name: time
                type: integer
                description: Unix timestamp tính bằng giây của thời điểm bắt đầu nến.
                required: true
              - name: lastUpdated
                type: integer
                description: Unix timestamp tính bằng giây của lần cập nhật gần nhất.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: Dữ liệu OHLC của nến đang hình thành.
          required:
            - T
            - symbol
            - open
            - high
            - low
            - close
            - volume
            - resolution
            - time
            - type
            - lastUpdated
          properties:
            T:
              type: string
              description: Mã loại message OHLC đang hình thành.
              const: b
              x-parser-schema-id: <anonymous-schema-184>
            symbol:
              type: string
              description: Mã chứng khoán hoặc chỉ số.
              x-parser-schema-id: <anonymous-schema-185>
            type:
              type: string
              description: Loại nhóm thị trường, ví dụ STOCK, DERIVATIVE hoặc INDEX.
              x-parser-schema-id: <anonymous-schema-186>
            resolution:
              type: string
              description: Khung thời gian nến.
              x-parser-schema-id: <anonymous-schema-187>
            open:
              type: number
              description: Giá mở cửa.
              x-parser-schema-id: <anonymous-schema-188>
            high:
              type: number
              description: Giá cao nhất trong nến.
              x-parser-schema-id: <anonymous-schema-189>
            low:
              type: number
              description: Giá thấp nhất trong nến.
              x-parser-schema-id: <anonymous-schema-190>
            close:
              type: number
              description: Giá đóng cửa.
              x-parser-schema-id: <anonymous-schema-191>
            volume:
              type: integer
              description: Khối lượng giao dịch.
              x-parser-schema-id: <anonymous-schema-192>
            time:
              type: integer
              format: int64
              description: Unix timestamp tính bằng giây của thời điểm bắt đầu nến.
              x-parser-schema-id: <anonymous-schema-193>
            lastUpdated:
              type: integer
              format: int64
              description: Unix timestamp tính bằng giây của lần cập nhật gần nhất.
              x-parser-schema-id: <anonymous-schema-194>
          x-parser-schema-id: <anonymous-schema-183>
        title: Cập nhật nến đang hình thành
        description: Bản cập nhật OHLC của nến hiện tại.
        example: |-
          {
            "T": "b",
            "close": 21,
            "high": 21,
            "lastUpdated": 1787122044,
            "low": 21,
            "open": 21,
            "resolution": "1",
            "symbol": "HPG",
            "time": 1787122020,
            "type": "STOCK",
            "volume": 16700
          }
        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: ohlcStream
securitySchemes: []

````

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