> ## 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ịch sử chỉ số

> Truy vấn thông tin lịch sử các chỉ số thị trường theo khoảng thời gian.



## OpenAPI

````yaml /vi/openapi/dnse.openapi.yaml get /price/{indexName}/market-index
openapi: 3.0.0
info:
  title: DNSE OpenAPI (2026-09-25)
  version: 2.0.0
  description: DNSE OpenAPI spec
servers:
  - url: https://openapi.dnse.com.vn
    description: Production
  - url: https://sb-openapi.dnse.com.vn
    description: Sanbox
security: []
tags:
  - name: trading
    description: Xác thực và các hoạt động đặt lệnh.
    x-group: Giao dịch
  - name: account
    description: Tài khoản, số dư, khoản vay, lệnh và vị thế.
    x-group: Tài khoản
  - name: market
    description: Thông tin mã chứng khoán, báo giá, OHLC và giao dịch.
    x-group: Dữ liệu thị trường
paths:
  /price/{indexName}/market-index:
    get:
      tags:
        - market
      summary: Lịch sử chỉ số
      description: Truy vấn thông tin lịch sử các chỉ số thị trường theo khoảng thời gian.
      operationId: market_getMarketIndex
      parameters:
        - $ref: '#/components/parameters/XApiKey'
        - $ref: '#/components/parameters/XAuxDate'
        - $ref: '#/components/parameters/XSignature'
        - name: indexName
          in: path
          required: true
          description: Tên chỉ số thị trường.
          schema:
            $ref: '#/components/schemas/MarketIndex'
          example: VN30
        - name: from
          in: query
          required: true
          description: Thời gian bắt đầu (timestamp).
          schema:
            type: string
          example: '1788915600'
        - name: to
          in: query
          required: true
          description: Thời gian kết thúc (timestamp).
          schema:
            type: string
          example: '1788922800'
        - name: limit
          in: query
          required: false
          description: Số lượng bản ghi tối đa trả về.
          schema:
            type: integer
            format: int32
            minimum: 1
          example: 100
        - name: order
          in: query
          required: false
          description: Thứ tự dữ liệu theo thời gian.
          schema:
            type: string
            enum:
              - ASC
              - DESC
            default: DESC
          example: DESC
        - name: nextPageToken
          in: query
          required: false
          description: Token dùng để lấy trang tiếp theo.
          schema:
            type: string
          example: NDYwMTQ1XzIwMjYtMDMtMTJUMDQ6MjU6MDUuNTZa
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketIndexHistoryResponse'
              example:
                data:
                  - indexName: VN30
                    valueIndexes: 1867.57
                    changedValue: -8.57
                    changedRatio: -0.46
                    fluctuationUpIssueCount: 4
                    fluctuationDownIssueCount: 24
                    fluctuationSteadinessIssueCount: 2
                    fluctuationLowerLimitIssueCount: 1
                    fluctuationUpperLimitIssueCount: 0
                    fluctuationDownIssueVolume: 151005844
                    fluctuationUpIssueVolume: 12011382
                    fluctuationSteadinessIssueVolume: 19131891
                    currencyCode: VND
                    indexTypeCode: '101'
                    lowestValueIndexes: 1864.16
                    highestValueIndexes: 1879.66
                    priorValueIndexes: 1876.14
                    contauctAccTrdVal: 4001.6785832
                    contauctAccTrdVol: 119469304
                    blkTrdAccTrdVal: 1633.46998985
                    blkTrdAccTrdVol: 62679813
                    grossTradeAmount: 5635.14857305
                    totalVolumeTraded: 182149117
                    marketIndexClass: HSX
                    marketId: STO
                    tradingSessionId: '40'
                    time: '2026-09-10 09:15:00.000'
                nextPageToken: NDYwMTQ1XzIwMjYtMDMtMTJUMDQ6MjU6MDUuNTZa
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    XApiKey:
      name: X-Api-Key
      in: header
      required: true
      description: >-
        API key được cấp khi đăng ký dịch vụ DNSE OpenAPI.

        Ví dụ:
        `b3JnOmRuc2UgaWQ6MjdlZTc1MzcxZGFkNTY0NmYzYTM2NDk1ZGE3OGNiOGQgaDptdXJtdXIxMjg=`
      schema:
        type: string
    XAuxDate:
      name: X-Aux-Date
      in: header
      required: true
      description: |-
        Thời gian thực hiện request, dùng trong cơ chế ký request của DNSE.
        Ví dụ: `Sat, 01 May 2026 14:24:23 +0000`
      schema:
        type: string
    XSignature:
      name: X-Signature
      in: header
      required: true
      description: >-
        Chữ ký xác thực request được tạo từ API key secret và X-Aux-Date.

        Ví dụ: `Signature
        keyId="b3JnOmRuc2UgaWQ6MjdlZTc1MzcxZGFkNTY0NmYzYTM2NDk1ZGE3OGNiOGQgaDptdXJtdXIxMjg=",algorithm="hmac-sha256",headers="(request-target)
        x-aux-date",signature="rfbVXHDUi%2B%2FsOkLXle7O17Qm%2F05cbISSR%2BDcFrBHfqQ%3D",nonce="4add8c3264e4492b9f8ecde0cf26b523"`
      schema:
        type: string
  schemas:
    MarketIndex:
      type: string
      description: |-
        Tên chỉ số thị trường.

        - `VNINDEX`: Chỉ số sàn HOSE
        - `HNX`: Chỉ số sàn HNX
        - `HNX30`: Chỉ số Top 30 cổ phiếu sàn HNX
        - `VN30`: Chỉ số Top 30 cổ phiếu sàn HOSE
        - `VN100`: Chỉ số Top 100 cổ phiếu sàn HOSE
        - `VNXALLSHARE`: Chỉ số các cổ phiếu chọn lọc sàn HOSE
        - `UPCOM`: Chỉ số sàn UPCOM
        - `VNMITECH`: Chỉ số nhóm cổ phiếu công nghệ
        - `VN50GROWTH`: Chỉ số nhóm 50 cổ phiếu tăng trưởng sàn HOSE
        - `VNDIVIDEND`: Chỉ số nhóm cổ phiếu có tỷ suất cổ tức tăng trưởng
      enum:
        - VNINDEX
        - HNX
        - HNX30
        - VN30
        - VN100
        - VNXALLSHARE
        - UPCOM
        - VNMITECH
        - VN50GROWTH
        - VNDIVIDEND
      x-enum-descriptions:
        - Chỉ số sàn HOSE
        - Chỉ số sàn HNX
        - Chỉ số Top 30 cổ phiếu sàn HNX
        - Chỉ số Top 30 cổ phiếu sàn HOSE
        - Chỉ số Top 100 cổ phiếu sàn HOSE
        - Chỉ số các cổ phiếu chọn lọc sàn HOSE
        - Chỉ số sàn UPCOM
        - Chỉ số nhóm cổ phiếu công nghệ
        - Chỉ số nhóm 50 cổ phiếu tăng trưởng sàn HOSE
        - Chỉ số nhóm cổ phiếu có tỷ suất cổ tức tăng trưởng
      x-enum-varnames:
        - VNINDEX
        - HNX
        - HNX30
        - VN30
        - VN100
        - VNXALLSHARE
        - UPCOM
        - VNMITECH
        - VN50GROWTH
        - VNDIVIDEND
      example: VN30
    MarketIndexHistoryResponse:
      type: object
      description: Danh sách dữ liệu lịch sử chỉ số thị trường.
      properties:
        data:
          type: array
          description: Danh sách bản ghi lịch sử chỉ số.
          items:
            $ref: '#/components/schemas/MarketIndexHistoryItem'
        nextPageToken:
          type: string
          description: Token dùng để lấy trang tiếp theo.
          example: NDYwMTQ1XzIwMjYtMDMtMTJUMDQ6MjU6MDUuNTZa
    MarketIndexHistoryItem:
      type: object
      description: Một bản ghi lịch sử chỉ số thị trường.
      properties:
        indexName:
          type: string
          description: Tên chỉ số thị trường.
        valueIndexes:
          type: number
          format: double
          description: Giá trị chỉ số.
        changedValue:
          type: number
          format: double
          description: Giá trị tăng hoặc giảm so với giá tham chiếu.
        changedRatio:
          type: number
          format: double
          description: Tỷ lệ phần trăm tăng hoặc giảm so với giá tham chiếu.
        fluctuationSteadinessIssueCount:
          type: integer
          description: Số lượng mã có giá không đổi.
        fluctuationDownIssueCount:
          type: integer
          description: Số lượng mã có giá giảm.
        fluctuationUpIssueCount:
          type: integer
          description: Số lượng mã có giá tăng.
        fluctuationLowerLimitIssueCount:
          type: integer
          description: Số lượng mã giảm sàn.
        fluctuationUpperLimitIssueCount:
          type: integer
          description: Số lượng mã tăng trần.
        fluctuationDownIssueVolume:
          type: integer
          format: int64
          description: Tổng khối lượng giao dịch các mã có giá giảm.
        fluctuationUpIssueVolume:
          type: integer
          format: int64
          description: Tổng khối lượng giao dịch các mã có giá tăng.
        fluctuationSteadinessIssueVolume:
          type: integer
          format: int64
          description: Tổng khối lượng giao dịch các mã có giá không đổi.
        currencyCode:
          type: string
          description: Đơn vị tiền tệ.
        indexTypeCode:
          type: string
          description: Mã loại chỉ số.
        lowestValueIndexes:
          type: number
          format: double
          description: Giá trị thấp nhất trong phiên.
        highestValueIndexes:
          type: number
          format: double
          description: Giá trị cao nhất trong phiên.
        priorValueIndexes:
          type: number
          format: double
          description: Giá trị tham chiếu.
        contauctAccTrdVal:
          type: number
          format: double
          description: Tổng giá trị giao dịch theo phương thức khớp lệnh.
        contauctAccTrdVol:
          type: integer
          format: int64
          description: Tổng khối lượng giao dịch theo phương thức khớp lệnh.
        blkTrdAccTrdVal:
          type: number
          format: double
          description: Tổng giá trị giao dịch theo phương thức thỏa thuận.
        blkTrdAccTrdVol:
          type: integer
          format: int64
          description: Tổng khối lượng giao dịch theo phương thức thỏa thuận.
        grossTradeAmount:
          type: number
          format: double
          description: Tổng giá trị giao dịch trong ngày.
        totalVolumeTraded:
          type: integer
          format: int64
          description: Tổng khối lượng giao dịch trong ngày.
        marketIndexClass:
          oneOf:
            - type: integer
            - type: string
          description: Phân loại chỉ số.
        marketId:
          type: string
          description: Mã thị trường.
        tradingSessionId:
          type: string
          description: Mã phiên giao dịch.
        time:
          type: string
          description: >-
            Thời điểm ghi nhận dữ liệu theo định dạng DNSE `YYYY-MM-DD
            HH:mm:ss.SSS`.
          pattern: ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(\.\d{3})?$
    ErrorBody:
      type: object
      required:
        - status
        - code
        - message
      properties:
        status:
          type: integer
          format: int32
          description: Mã HTTP.
          example: 400
        code:
          type: string
          description: Mã lỗi DNSE.
          example: OA-003
        message:
          type: string
          description: Thông điệp lỗi.
          example: Thông tin nhập không hợp lệ
  responses:
    BadRequest:
      description: Yêu cầu không hợp lệ.
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLength'
        Date:
          $ref: '#/components/headers/Date'
        Vary:
          $ref: '#/components/headers/Vary'
        X-Ratelimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-Ratelimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-Ratelimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Tyk-Api-Expires:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: 400
            code: OA-003
            message: Thông tin nhập không hợp lệ
    InternalError:
      description: Lỗi hệ thống.
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLength'
        Date:
          $ref: '#/components/headers/Date'
        Vary:
          $ref: '#/components/headers/Vary'
        X-Ratelimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-Ratelimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-Ratelimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Tyk-Api-Expires:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: 500
            code: OA-009
            message: Lỗi hệ thống
  headers:
    ContentLength:
      description: Response body size in bytes.
      schema:
        type: integer
      example: 430
    Date:
      description: Response date from the DNSE gateway.
      schema:
        type: string
      example: Wed, 18 Mar 2026 16:17:35 GMT
    Vary:
      description: >-
        Response header indicating the request headers used for content
        negotiation.
      schema:
        type: string
      example: Origin
    XRateLimitLimit:
      description: Maximum number of requests allowed in the current rate-limit window.
      schema:
        type: integer
      example: 300
    XRateLimitRemaining:
      description: Number of requests remaining in the current rate-limit window.
      schema:
        type: integer
      example: 299
    XRateLimitReset:
      description: Unix timestamp at which the current rate-limit window resets.
      schema:
        type: integer
      example: 1773850655
    XRequestId:
      description: Unique identifier assigned to the request by the DNSE gateway.
      schema:
        type: string
      example: unknown

````

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