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

# Lệnh giao dịch

> Cung cấp thông tin chi tiết về lệnh giao dịch trên tài khoản người dùng theo thời gian thực.
Hệ thống sẽ đẩy dữ liệu ngay khi có sự thay đổi liên quan đến:
lệnh mới, thay đổi trạng thái, hoặc thay đổi giá khớp, khối lượng khớp.



## AsyncAPI

````yaml vi/asyncapi/dnse.2026-09-10.asyncapi.yaml orderStream
id: orderStream
title: Lệnh giao dịch
description: >-
  Cung cấp thông tin chi tiết về lệnh giao dịch trên tài khoản người dùng theo
  thời gian thực.

  Hệ thống sẽ đẩy dữ liệu ngay khi có sự thay đổi liên quan đến:

  lệnh mới, thay đổi trạng thái, hoặc thay đổi giá khớp, khối lượng khớp.
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: onOrderSubscription
    title: Đăng ký luồng lệnh của nhà đầu tư
    type: receive
    messages:
      - &ref_3
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Đăng ký luồng lệnh của nhà đầu tư
            description: Đăng ký topic `order.{market_type}.{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 lệnh của nhà đầu tư hiện tại theo loại thị trường.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - action
            - channels
          properties:
            action:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-359>
            channels:
              type: array
              minItems: 1
              uniqueItems: true
              items:
                type: object
                additionalProperties: false
                required:
                  - name
                properties:
                  name:
                    type: string
                    description: Topic lệnh của nhà đầu tư hiện tại theo loại thị trường.
                    pattern: ^order\.(STOCK|DERIVATIVE)\.json$
                    x-parser-schema-id: <anonymous-schema-362>
                x-parser-schema-id: <anonymous-schema-361>
              x-parser-schema-id: <anonymous-schema-360>
          x-parser-schema-id: <anonymous-schema-358>
        title: Đăng ký luồng lệnh của nhà đầu tư
        description: Đăng ký topic `order.{market_type}.{encoding}`.
        example: |-
          {
            "action": "subscribe",
            "channels": [
              {
                "name": "order.STOCK.json"
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: orderStream
  - &ref_2
    id: onOrderUpdates
    title: Nhận cập nhật lệnh của nhà đầu tư
    type: send
    messages:
      - &ref_4
        id: update
        contentType: application/json
        payload:
          - name: Cập nhật lệnh của nhà đầu tư
            description: Bản cập nhật trạng thái lệnh của nhà đầu tư hiện tại.
            type: object
            properties:
              - name: T
                type: string
                description: Mã loại message cập nhật lệnh.
                required: true
              - name: action
                type: string
                description: Loại hành động của message.
                required: true
              - name: event
                type: string
                description: Sự kiện làm phát sinh cập nhật lệnh.
                required: true
              - name: order
                type: object
                description: Thông tin lệnh được cập nhật.
                required: true
                properties:
                  - name: id
                    type: integer
                    description: Mã định danh lệnh giao dịch.
                    required: true
                  - name: accountNo
                    type: string
                    description: Số tiểu khoản giao dịch.
                    required: true
                  - name: symbol
                    type: string
                    description: Mã chứng khoán.
                    required: true
                  - name: side
                    type: string
                    description: Chiều đặt lệnh, NB là mua và NS là bán.
                    required: true
                  - name: orderType
                    type: string
                    description: Loại lệnh.
                    required: true
                  - name: price
                    type: number
                    description: Giá đặt.
                    required: true
                  - name: priceSecure
                    type: number
                    description: Giá đảm bảo.
                    required: true
                  - name: averagePrice
                    type: number
                    description: Giá khớp trung bình.
                    required: true
                  - name: quantity
                    type: integer
                    description: Khối lượng đặt.
                    required: true
                  - name: fillQuantity
                    type: integer
                    description: Khối lượng đã khớp.
                    required: true
                  - name: canceledQuantity
                    type: integer
                    description: Khối lượng đã hủy.
                    required: true
                  - name: leaveQuantity
                    type: integer
                    description: Khối lượng còn lại chưa khớp.
                    required: true
                  - name: orderStatus
                    type: string
                    description: Trạng thái lệnh.
                    required: true
                  - name: marketType
                    type: string
                    description: Loại thị trường.
                    enumValues:
                      - STOCK
                      - DERIVATIVE
                    required: true
                  - name: loanPackageId
                    type: integer
                    description: Mã gói vay.
                    required: true
                  - name: transDate
                    type: string
                    description: Ngày giao dịch.
                    required: true
                  - name: createdDate
                    type: string
                    description: Thời điểm tạo (UTC).
                    required: true
                  - name: modifiedDate
                    type: string
                    description: Thời điểm cập nhật (UTC).
                    required: true
              - name: sequence
                type: integer
                description: Số thứ tự của message trong luồng.
                required: true
              - name: timestamp
                type: integer
                description: >-
                  Thời điểm phát sinh message, Unix timestamp tính bằng
                  mili-giây.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          description: Dữ liệu cập nhật lệnh của nhà đầu tư hiện tại.
          additionalProperties: false
          required:
            - T
            - action
            - event
            - order
            - sequence
            - timestamp
          properties:
            T:
              type: string
              const: eo
              description: Mã loại message cập nhật lệnh.
              x-parser-schema-id: <anonymous-schema-364>
            action:
              type: string
              const: order_update
              description: Loại hành động của message.
              x-parser-schema-id: <anonymous-schema-365>
            event:
              type: string
              description: Sự kiện làm phát sinh cập nhật lệnh.
              x-parser-schema-id: <anonymous-schema-366>
            order:
              type: object
              description: Thông tin lệnh được cập nhật.
              required:
                - id
                - accountNo
                - symbol
                - orderStatus
                - marketType
                - side
                - orderType
                - price
                - priceSecure
                - averagePrice
                - quantity
                - fillQuantity
                - canceledQuantity
                - leaveQuantity
                - loanPackageId
                - transDate
                - createdDate
                - modifiedDate
              properties:
                id:
                  type: integer
                  format: int64
                  description: Mã định danh lệnh giao dịch.
                  x-parser-schema-id: <anonymous-schema-368>
                accountNo:
                  type: string
                  description: Số tiểu khoản giao dịch.
                  x-parser-schema-id: <anonymous-schema-369>
                symbol:
                  type: string
                  description: Mã chứng khoán.
                  x-parser-schema-id: <anonymous-schema-370>
                side:
                  type: string
                  description: Chiều đặt lệnh, NB là mua và NS là bán.
                  x-parser-schema-id: <anonymous-schema-371>
                orderType:
                  type: string
                  description: Loại lệnh.
                  x-parser-schema-id: <anonymous-schema-372>
                price:
                  type: number
                  description: Giá đặt.
                  x-parser-schema-id: <anonymous-schema-373>
                priceSecure:
                  type: number
                  description: Giá đảm bảo.
                  x-parser-schema-id: <anonymous-schema-374>
                averagePrice:
                  type: number
                  description: Giá khớp trung bình.
                  x-parser-schema-id: <anonymous-schema-375>
                quantity:
                  type: integer
                  description: Khối lượng đặt.
                  x-parser-schema-id: <anonymous-schema-376>
                fillQuantity:
                  type: integer
                  description: Khối lượng đã khớp.
                  x-parser-schema-id: <anonymous-schema-377>
                canceledQuantity:
                  type: integer
                  description: Khối lượng đã hủy.
                  x-parser-schema-id: <anonymous-schema-378>
                leaveQuantity:
                  type: integer
                  description: Khối lượng còn lại chưa khớp.
                  x-parser-schema-id: <anonymous-schema-379>
                orderStatus:
                  type: string
                  description: Trạng thái lệnh.
                  x-parser-schema-id: <anonymous-schema-380>
                marketType:
                  type: string
                  description: Loại thị trường.
                  enum:
                    - STOCK
                    - DERIVATIVE
                  x-enum-descriptions:
                    - STOCK
                    - DERIVATIVE
                  x-enum-varnames:
                    - STOCK
                    - DERIVATIVE
                  x-parser-schema-id: <anonymous-schema-381>
                loanPackageId:
                  type: integer
                  format: int64
                  description: Mã gói vay.
                  x-parser-schema-id: <anonymous-schema-382>
                transDate:
                  type: string
                  format: date-time
                  description: Ngày giao dịch.
                  x-parser-schema-id: <anonymous-schema-383>
                createdDate:
                  type: string
                  format: date-time
                  description: Thời điểm tạo (UTC).
                  x-parser-schema-id: <anonymous-schema-384>
                modifiedDate:
                  type: string
                  format: date-time
                  description: Thời điểm cập nhật (UTC).
                  x-parser-schema-id: <anonymous-schema-385>
              x-parser-schema-id: <anonymous-schema-367>
            sequence:
              type: integer
              format: int64
              description: Số thứ tự của message trong luồng.
              x-parser-schema-id: <anonymous-schema-386>
            timestamp:
              type: integer
              format: int64
              description: Thời điểm phát sinh message, Unix timestamp tính bằng mili-giây.
              x-parser-schema-id: <anonymous-schema-387>
          x-parser-schema-id: <anonymous-schema-363>
        title: Cập nhật lệnh của nhà đầu tư
        description: Bản cập nhật trạng thái lệnh của nhà đầu tư hiện tại.
        example: |-
          {
            "T": "eo",
            "action": "order_update",
            "event": "canceled",
            "order": {
              "id": 596,
              "side": "NS",
              "accountNo": "0001179019",
              "symbol": "41I1G5000",
              "orderType": "LO",
              "price": 1920,
              "priceSecure": 1920,
              "averagePrice": 1921,
              "quantity": 5,
              "fillQuantity": 2,
              "canceledQuantity": 0,
              "leaveQuantity": 3,
              "orderStatus": "PartiallyFilled",
              "loanPackageId": 2278,
              "marketType": "DERIVATIVE",
              "transDate": "2026-04-06T00:00:00Z",
              "createdDate": "2026-04-13T04:24:05.274Z",
              "modifiedDate": "2026-04-13T04:28:27.749Z"
            },
            "sequence": 4,
            "timestamp": 1781234866949
          }
        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: orderStream
securitySchemes: []

````

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