> ## 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) đã đóng

> Cung cấp dữ liệu nến đã đóng theo từng khung thời gian (resolution).
Dữ liệu chỉ gửi khi kết thúc mỗi khung thời gian và không thay đổi sau đó.



## AsyncAPI

````yaml vi/asyncapi/dnse.2026-09-10.asyncapi.yaml ohlcClosedStream
id: ohlcClosedStream
title: Nến (OHLC) đã đóng
description: |-
  Cung cấp dữ liệu nến đã đóng theo từng khung thời gian (resolution).
  Dữ liệu chỉ gửi khi kết thúc mỗi khung thời gian và không thay đổi sau đó.
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: onOhlcClosedSubscription
    title: Đăng ký luồng nến đã đóng
    type: receive
    messages:
      - &ref_3
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Đăng ký luồng nến đã đóng
            description: Đăng ký topic `ohlc_closed.{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 đã đóng 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-196>
            channels:
              type: array
              minItems: 1
              uniqueItems: true
              items:
                type: object
                additionalProperties: false
                required:
                  - name
                  - symbols
                properties:
                  name:
                    type: string
                    description: Topic nến đã đóng theo độ phân giải.
                    pattern: ^ohlc_closed\.[0-9]+\.json$
                    x-parser-schema-id: <anonymous-schema-199>
                  symbols:
                    type: array
                    minItems: 1
                    uniqueItems: true
                    items:
                      type: string
                      minLength: 1
                      x-parser-schema-id: <anonymous-schema-201>
                    x-parser-schema-id: <anonymous-schema-200>
                x-parser-schema-id: <anonymous-schema-198>
              x-parser-schema-id: <anonymous-schema-197>
          x-parser-schema-id: <anonymous-schema-195>
        title: Đăng ký luồng nến đã đóng
        description: Đăng ký topic `ohlc_closed.{resolution}.{encoding}`.
        example: |-
          {
            "action": "subscribe",
            "channels": [
              {
                "name": "ohlc_closed.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: ohlcClosedStream
  - &ref_2
    id: onOhlcClosedUpdates
    title: Nhận cập nhật nến đã đóng
    type: send
    messages:
      - &ref_4
        id: update
        contentType: application/json
        payload:
          - name: Cập nhật nến đã đóng
            description: Bản cập nhật OHLC của nến đã hoàn tất.
            type: object
            properties:
              - name: T
                type: string
                description: Mã loại message OHLC đã đóng.
                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 đã hoàn tất.
          required:
            - T
            - symbol
            - open
            - high
            - low
            - close
            - volume
            - resolution
            - time
            - type
            - lastUpdated
          properties:
            T:
              type: string
              description: Mã loại message OHLC đã đóng.
              const: bc
              x-parser-schema-id: <anonymous-schema-203>
            symbol:
              type: string
              description: Mã chứng khoán hoặc chỉ số.
              x-parser-schema-id: <anonymous-schema-204>
            type:
              type: string
              description: Loại nhóm thị trường, ví dụ STOCK, DERIVATIVE hoặc INDEX.
              x-parser-schema-id: <anonymous-schema-205>
            resolution:
              type: string
              description: Khung thời gian nến.
              x-parser-schema-id: <anonymous-schema-206>
            open:
              type: number
              description: Giá mở cửa.
              x-parser-schema-id: <anonymous-schema-207>
            high:
              type: number
              description: Giá cao nhất trong nến.
              x-parser-schema-id: <anonymous-schema-208>
            low:
              type: number
              description: Giá thấp nhất trong nến.
              x-parser-schema-id: <anonymous-schema-209>
            close:
              type: number
              description: Giá đóng cửa.
              x-parser-schema-id: <anonymous-schema-210>
            volume:
              type: integer
              description: Khối lượng giao dịch.
              x-parser-schema-id: <anonymous-schema-211>
            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-212>
            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-213>
          x-parser-schema-id: <anonymous-schema-202>
        title: Cập nhật nến đã đóng
        description: Bản cập nhật OHLC của nến đã hoàn tất.
        example: |-
          {
            "T": "bc",
            "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: ohlcClosedStream
securitySchemes: []

````

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