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

# Bảng giá phái sinh

> Client xác thực bằng `d|a|||<BASE64_JWT>`, subscribe bằng `d|s|tk|...`,
unsubscribe bằng `d|u|tk|...` và gửi heartbeat `d|p|||` mỗi 2 giây.



## AsyncAPI

````yaml vi/openapi/tcbs.v1.asyncapi.yaml derivativeMarketStream
id: derivativeMarketStream
title: Bảng giá phái sinh
description: |-
  Client xác thực bằng `d|a|||<BASE64_JWT>`, subscribe bằng `d|s|tk|...`,
  unsubscribe bằng `d|u|tk|...` và gửi heartbeat `d|p|||` mỗi 2 giây.
servers:
  - id: production
    protocol: wss
    host: openapi.tcbs.com.vn
    bindings: []
    variables: []
address: /ws/thesis/v1/stream/derivative
parameters: []
bindings: []
operations:
  - &ref_2
    id: sendDerivativeMarketCommand
    title: Gửi lệnh điều khiển bảng giá phái sinh
    type: receive
    messages:
      - &ref_4
        id: command
        contentType: text/plain
        payload:
          - type: string
            examples: &ref_0
              - d|s|tk|bp+bi+tm+mp+op+fe|VN30F1M
              - d|p|||
            x-parser-schema-id: <anonymous-schema-86>
            name: Lệnh điều khiển bảng giá phái sinh
        headers: []
        jsonPayloadSchema:
          type: string
          examples: *ref_0
          x-parser-schema-id: <anonymous-schema-86>
        title: Lệnh điều khiển bảng giá phái sinh
        example: '"d|s|tk|bp+bi+tm+mp+op+fe|VN30F1M"'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: command
    bindings: []
    extensions: &ref_1
      - id: x-parser-unique-object-id
        value: derivativeMarketStream
  - &ref_3
    id: receiveDerivativeMarketData
    title: Nhận dữ liệu bảng giá phái sinh
    type: send
    messages:
      - &ref_5
        id: authResult
        contentType: application/json
        payload:
          - name: Kết quả xác thực Thesis
            description: >-
              Trên wire server gửi `d|0|{JSON_PAYLOAD}`; payload dưới đây là
              phần JSON đã tách prefix.
            type: object
            properties:
              - name: success
                type: boolean
                description: Kết quả xác thực.
                required: true
              - name: error
                type: object
                required: false
                properties:
                  - name: code
                    type: string
                    required: true
                  - name: message
                    type: string
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - success
          properties:
            success:
              type: boolean
              description: Kết quả xác thực.
              x-parser-schema-id: <anonymous-schema-88>
            error:
              oneOf:
                - type: 'null'
                  x-parser-schema-id: <anonymous-schema-90>
                - type: object
                  required:
                    - code
                    - message
                  properties:
                    code:
                      type: string
                      x-parser-schema-id: <anonymous-schema-92>
                    message:
                      type: string
                      x-parser-schema-id: <anonymous-schema-93>
                  x-parser-schema-id: <anonymous-schema-91>
              x-parser-schema-id: <anonymous-schema-89>
          x-parser-schema-id: <anonymous-schema-87>
        title: Kết quả xác thực Thesis
        description: >-
          Trên wire server gửi `d|0|{JSON_PAYLOAD}`; payload dưới đây là phần
          JSON đã tách prefix.
        example: |-
          {
            "success": true,
            "error": null
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: authResult
      - &ref_6
        id: tradeUpdate
        contentType: application/json
        payload:
          - name: Giao dịch khớp phái sinh
            description: Trên wire server gửi `s|21|{JSON_PAYLOAD}`.
            type: object
            properties:
              - name: symbol
                type: string
                description: Mã hợp đồng phái sinh.
                required: true
              - name: matchPrice
                type: number
                description: Giá khớp.
                required: true
              - name: matchQtty
                type: integer
                description: Khối lượng khớp.
                required: true
              - name: change
                type: number
                description: Thay đổi so với giá tham chiếu.
                required: true
              - name: changePercent
                type: number
                description: Phần trăm thay đổi.
                required: true
              - name: totalVolume
                type: integer
                description: Tổng khối lượng trong phiên.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - symbol
            - matchPrice
            - matchQtty
            - change
            - changePercent
            - totalVolume
          properties:
            symbol:
              type: string
              description: Mã hợp đồng phái sinh.
              x-parser-schema-id: <anonymous-schema-95>
            matchPrice:
              type: number
              description: Giá khớp.
              x-parser-schema-id: <anonymous-schema-96>
            matchQtty:
              type: integer
              format: int64
              description: Khối lượng khớp.
              x-parser-schema-id: <anonymous-schema-97>
            change:
              type: number
              description: Thay đổi so với giá tham chiếu.
              x-parser-schema-id: <anonymous-schema-98>
            changePercent:
              type: number
              description: Phần trăm thay đổi.
              x-parser-schema-id: <anonymous-schema-99>
            totalVolume:
              type: integer
              format: int64
              description: Tổng khối lượng trong phiên.
              x-parser-schema-id: <anonymous-schema-100>
          x-parser-schema-id: <anonymous-schema-94>
        title: Giao dịch khớp phái sinh
        description: Trên wire server gửi `s|21|{JSON_PAYLOAD}`.
        example: |-
          {
            "symbol": "41I1G8000",
            "matchPrice": 1870.5,
            "matchQtty": 2,
            "change": -4.5,
            "changePercent": -0.24,
            "totalVolume": 15234
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: tradeUpdate
      - &ref_7
        id: bidUpdate
        contentType: application/json
        payload:
          - name: Sổ lệnh mua phái sinh
            description: Trên wire server gửi `s|23|{JSON_PAYLOAD}`.
            type: object
            properties:
              - name: symbol
                type: string
                description: Mã hợp đồng phái sinh.
                required: true
              - name: bidPrice01
                type: number
                description: Giá bid tốt nhất.
                required: true
              - name: bidPrice02
                type: number
                description: Giá bid mức 2.
                required: true
              - name: bidPrice03
                type: number
                description: Giá bid mức 3.
                required: true
              - name: bidQtty01
                type: integer
                description: Khối lượng bid mức 1.
                required: true
              - name: bidQtty02
                type: integer
                description: Khối lượng bid mức 2.
                required: true
              - name: bidQtty03
                type: integer
                description: Khối lượng bid mức 3.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - symbol
            - bidPrice01
            - bidPrice02
            - bidPrice03
            - bidQtty01
            - bidQtty02
            - bidQtty03
          properties:
            symbol:
              type: string
              description: Mã hợp đồng phái sinh.
              x-parser-schema-id: <anonymous-schema-102>
            bidPrice01:
              type: number
              description: Giá bid tốt nhất.
              x-parser-schema-id: <anonymous-schema-103>
            bidPrice02:
              type: number
              description: Giá bid mức 2.
              x-parser-schema-id: <anonymous-schema-104>
            bidPrice03:
              type: number
              description: Giá bid mức 3.
              x-parser-schema-id: <anonymous-schema-105>
            bidQtty01:
              type: integer
              format: int64
              description: Khối lượng bid mức 1.
              x-parser-schema-id: <anonymous-schema-106>
            bidQtty02:
              type: integer
              format: int64
              description: Khối lượng bid mức 2.
              x-parser-schema-id: <anonymous-schema-107>
            bidQtty03:
              type: integer
              format: int64
              description: Khối lượng bid mức 3.
              x-parser-schema-id: <anonymous-schema-108>
          x-parser-schema-id: <anonymous-schema-101>
        title: Sổ lệnh mua phái sinh
        description: Trên wire server gửi `s|23|{JSON_PAYLOAD}`.
        example: |-
          {
            "symbol": "<string>",
            "bidPrice01": 123,
            "bidPrice02": 123,
            "bidPrice03": 123,
            "bidQtty01": 123,
            "bidQtty02": 123,
            "bidQtty03": 123
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: bidUpdate
      - &ref_8
        id: offerUpdate
        contentType: application/json
        payload:
          - name: Sổ lệnh bán phái sinh
            description: Trên wire server gửi `s|24|{JSON_PAYLOAD}`.
            type: object
            properties:
              - name: symbol
                type: string
                description: Mã hợp đồng phái sinh.
                required: true
              - name: offerPrice01
                type: number
                description: Giá offer tốt nhất.
                required: true
              - name: offerPrice02
                type: number
                description: Giá offer mức 2.
                required: true
              - name: offerPrice03
                type: number
                description: Giá offer mức 3.
                required: true
              - name: offerQtty01
                type: integer
                description: Khối lượng offer mức 1.
                required: true
              - name: offerQtty02
                type: integer
                description: Khối lượng offer mức 2.
                required: true
              - name: offerQtty03
                type: integer
                description: Khối lượng offer mức 3.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - symbol
            - offerPrice01
            - offerPrice02
            - offerPrice03
            - offerQtty01
            - offerQtty02
            - offerQtty03
          properties:
            symbol:
              type: string
              description: Mã hợp đồng phái sinh.
              x-parser-schema-id: <anonymous-schema-110>
            offerPrice01:
              type: number
              description: Giá offer tốt nhất.
              x-parser-schema-id: <anonymous-schema-111>
            offerPrice02:
              type: number
              description: Giá offer mức 2.
              x-parser-schema-id: <anonymous-schema-112>
            offerPrice03:
              type: number
              description: Giá offer mức 3.
              x-parser-schema-id: <anonymous-schema-113>
            offerQtty01:
              type: integer
              format: int64
              description: Khối lượng offer mức 1.
              x-parser-schema-id: <anonymous-schema-114>
            offerQtty02:
              type: integer
              format: int64
              description: Khối lượng offer mức 2.
              x-parser-schema-id: <anonymous-schema-115>
            offerQtty03:
              type: integer
              format: int64
              description: Khối lượng offer mức 3.
              x-parser-schema-id: <anonymous-schema-116>
          x-parser-schema-id: <anonymous-schema-109>
        title: Sổ lệnh bán phái sinh
        description: Trên wire server gửi `s|24|{JSON_PAYLOAD}`.
        example: |-
          {
            "symbol": "<string>",
            "offerPrice01": 123,
            "offerPrice02": 123,
            "offerPrice03": 123,
            "offerQtty01": 123,
            "offerQtty02": 123,
            "offerQtty03": 123
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: offerUpdate
      - &ref_9
        id: sessionUpdate
        contentType: application/json
        payload:
          - name: Thông tin phiên phái sinh
            description: Trên wire server gửi `s|27|{JSON_PAYLOAD}`.
            type: object
            properties:
              - name: symbol
                type: string
                description: Mã chứng khoán hoặc hợp đồng.
                required: true
              - name: high
                type: number
                description: Giá cao nhất phiên.
                required: true
              - name: low
                type: number
                description: Giá thấp nhất phiên.
                required: true
              - name: avg
                type: number
                description: Giá trung bình phiên.
                required: true
              - name: open
                type: number
                description: Giá mở cửa.
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - symbol
            - high
            - low
            - avg
            - open
          properties:
            symbol:
              type: string
              description: Mã chứng khoán hoặc hợp đồng.
              x-parser-schema-id: <anonymous-schema-118>
            high:
              type: number
              description: Giá cao nhất phiên.
              x-parser-schema-id: <anonymous-schema-119>
            low:
              type: number
              description: Giá thấp nhất phiên.
              x-parser-schema-id: <anonymous-schema-120>
            avg:
              type: number
              description: Giá trung bình phiên.
              x-parser-schema-id: <anonymous-schema-121>
            open:
              type: number
              description: Giá mở cửa.
              x-parser-schema-id: <anonymous-schema-122>
          x-parser-schema-id: <anonymous-schema-117>
        title: Thông tin phiên phái sinh
        description: Trên wire server gửi `s|27|{JSON_PAYLOAD}`.
        example: |-
          {
            "symbol": "<string>",
            "high": 123,
            "low": 123,
            "avg": 123,
            "open": 123
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: sessionUpdate
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
  - *ref_6
  - *ref_7
  - *ref_8
  - *ref_9
extensions:
  - id: x-parser-unique-object-id
    value: derivativeMarketStream
securitySchemes: []

````

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