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

# Khớp lệnh

> Cập nhật thông tin khớp lệnh và tổng quan giao dịch của mã chứng khoán.



## AsyncAPI

````yaml vi/asyncapi/ssi.2026-07-29.asyncapi.yaml tradeStream
id: tradeStream
title: Khớp lệnh
description: Cập nhật thông tin khớp lệnh và tổng quan giao dịch của mã chứng khoán.
servers:
  - id: production
    protocol: wss
    host: stream.ssi.com.vn
    bindings: []
    variables: []
address: /ws/v3
parameters: []
bindings: []
operations:
  - &ref_1
    id: onTradeSubscription
    title: Đăng ký luồng khớp lệnh
    type: receive
    messages:
      - &ref_4
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: Yêu cầu đăng ký market data
            description: Đăng ký các topic trên channel DATA.
            type: object
            properties:
              - name: method
                type: string
                description: SUBSCRIBE
                required: true
              - name: channel
                type: string
                description: DATA
                required: true
              - name: topics
                type: array
                description: Danh sách topic market data; mỗi phần tử là một chuỗi topic.
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - method
            - channel
            - topics
          properties:
            method:
              type: string
              const: SUBSCRIBE
              x-parser-schema-id: <anonymous-schema-25>
            channel:
              type: string
              const: DATA
              x-parser-schema-id: <anonymous-schema-26>
            topics:
              type: array
              minItems: 1
              uniqueItems: true
              description: Danh sách topic market data; mỗi phần tử là một chuỗi topic.
              items:
                type: string
                minLength: 1
                pattern: >-
                  ^(trade|quote|room|put|oddlot)\.(index|exchange|[A-Za-z0-9_-]+(?:-[A-Za-z0-9_-]+)*|\*)(?:@(tick|1m|5m))?$|^market\.(index|exchange|[A-Za-z0-9_-]+(?:-[A-Za-z0-9_-]+)*|\*)$
                x-parser-schema-id: <anonymous-schema-28>
              x-parser-schema-id: <anonymous-schema-27>
          x-parser-schema-id: <anonymous-schema-24>
        title: Yêu cầu đăng ký market data
        description: Đăng ký các topic trên channel DATA.
        example: |-
          {
            "method": "SUBSCRIBE",
            "channel": "DATA",
            "topics": [
              "trade.SSI",
              "quote.ACB-SSI-GVR-KDH",
              "room.vn30",
              "put.hose",
              "oddlot.SSI",
              "market.hose"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: tradeStream
  - &ref_2
    id: onTradeUnsubscription
    title: Hủy đăng ký luồng khớp lệnh
    type: receive
    messages:
      - &ref_5
        id: unsubscribeRequest
        contentType: application/json
        payload:
          - name: Yêu cầu hủy market data
            description: Hủy đăng ký các topic trên channel DATA.
            type: object
            properties:
              - name: method
                type: string
                description: UNSUBSCRIBE
                required: true
              - name: channel
                type: string
                description: DATA
                required: true
              - name: topics
                type: array
                description: Danh sách topic market data; mỗi phần tử là một chuỗi topic.
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - method
            - channel
            - topics
          properties:
            method:
              type: string
              const: UNSUBSCRIBE
              x-parser-schema-id: <anonymous-schema-30>
            channel:
              type: string
              const: DATA
              x-parser-schema-id: <anonymous-schema-31>
            topics:
              type: array
              minItems: 1
              uniqueItems: true
              description: Danh sách topic market data; mỗi phần tử là một chuỗi topic.
              items:
                type: string
                minLength: 1
                pattern: >-
                  ^(trade|quote|room|put|oddlot)\.(index|exchange|[A-Za-z0-9_-]+(?:-[A-Za-z0-9_-]+)*|\*)(?:@(tick|1m|5m))?$|^market\.(index|exchange|[A-Za-z0-9_-]+(?:-[A-Za-z0-9_-]+)*|\*)$
                x-parser-schema-id: <anonymous-schema-33>
              x-parser-schema-id: <anonymous-schema-32>
          x-parser-schema-id: <anonymous-schema-29>
        title: Yêu cầu hủy market data
        description: Hủy đăng ký các topic trên channel DATA.
        example: |-
          {
            "method": "UNSUBSCRIBE",
            "channel": "DATA",
            "topics": [
              "trade.SSI",
              "quote.SSI"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_0
  - &ref_3
    id: onTradeUpdates
    title: Nhận cập nhật khớp lệnh
    type: send
    messages:
      - &ref_6
        id: update
        contentType: application/json
        payload:
          - name: Cập nhật khớp lệnh
            description: Thông tin khớp lệnh theo thời gian thực.
            type: object
            properties:
              - name: channel
                type: string
                description: DATA
                required: true
              - name: topic
                type: string
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: s
                    type: string
                    description: Mã chứng khoán.
                    required: true
                  - name: t
                    type: string
                    description: Thời gian giao dịch, định dạng `YYYY/MM/DD HH:mi:ss`.
                    required: true
                  - name: p
                    type: string
                    description: Giá khớp.
                    required: true
                  - name: q
                    type: string
                    description: Khối lượng khớp.
                    required: true
                  - name: a
                    type: string
                    description: Giá khớp trung bình.
                    required: true
                  - name: si
                    type: string
                    description: B là Buy Up, S là Sell Down.
                    enumValues:
                      - B
                      - S
                    required: true
                  - name: o
                    type: string
                    description: Giá mở cửa.
                    required: true
                  - name: h
                    type: string
                    description: Giá cao nhất.
                    required: true
                  - name: l
                    type: string
                    description: Giá thấp nhất.
                    required: true
                  - name: v
                    type: string
                    description: Tổng khối lượng khớp trong ngày.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - channel
            - topic
            - data
          properties:
            channel:
              type: string
              const: DATA
              x-parser-schema-id: <anonymous-schema-35>
            topic:
              type: string
              pattern: >-
                ^trade\.(index|exchange|[A-Za-z0-9_-]+(?:-[A-Za-z0-9_-]+)*|\*)(?:@(tick|1m|5m))?$
              x-parser-schema-id: <anonymous-schema-36>
            data:
              type: object
              additionalProperties: false
              required:
                - s
                - t
                - p
                - q
                - a
                - si
                - o
                - h
                - l
                - v
              properties:
                s:
                  type: string
                  description: Mã chứng khoán.
                  x-parser-schema-id: <anonymous-schema-38>
                t:
                  type: string
                  description: Thời gian giao dịch, định dạng `YYYY/MM/DD HH:mi:ss`.
                  x-parser-schema-id: <anonymous-schema-39>
                p:
                  type: string
                  description: Giá khớp.
                  x-parser-schema-id: <anonymous-schema-40>
                q:
                  type: string
                  description: Khối lượng khớp.
                  x-parser-schema-id: <anonymous-schema-41>
                a:
                  type: string
                  description: Giá khớp trung bình.
                  x-parser-schema-id: <anonymous-schema-42>
                si:
                  type: string
                  enum:
                    - B
                    - S
                  description: B là Buy Up, S là Sell Down.
                  x-parser-schema-id: <anonymous-schema-43>
                o:
                  type: string
                  description: Giá mở cửa.
                  x-parser-schema-id: <anonymous-schema-44>
                h:
                  type: string
                  description: Giá cao nhất.
                  x-parser-schema-id: <anonymous-schema-45>
                l:
                  type: string
                  description: Giá thấp nhất.
                  x-parser-schema-id: <anonymous-schema-46>
                v:
                  type: string
                  description: Tổng khối lượng khớp trong ngày.
                  x-parser-schema-id: <anonymous-schema-47>
              x-parser-schema-id: <anonymous-schema-37>
          x-parser-schema-id: <anonymous-schema-34>
        title: Cập nhật khớp lệnh
        description: Thông tin khớp lệnh theo thời gian thực.
        example: |-
          {
            "channel": "DATA",
            "topic": "trade.SSI@tick",
            "data": {
              "s": "SSI",
              "t": "2026/07/29 09:15:32",
              "p": "45.50",
              "q": "1000",
              "a": "45.35",
              "si": "B",
              "o": "45.00",
              "h": "45.80",
              "l": "44.90",
              "v": "1250000"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: update
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
  - *ref_5
receiveMessages:
  - *ref_6
extensions:
  - id: x-parser-unique-object-id
    value: tradeStream
securitySchemes: []

````

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