> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tickdb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 交易日历

> 查询指定市场在特定时间范围内的交易日列表，用于判断某日是否为交易日。

## 套餐权限

| 套餐 | 可用 |
| - | :-: |
| 免费版 | ✅ |
| 基础版 | ✅ |
| 专业版 | ✅ |
| 全量套餐（A 股、港股、美股） | ✅ |
| 企业版 | ✅ |

## 注意事项

* 日期格式必须为 YYYYMMDD（如：20260201）
* 单次查询的日期范围最多为 31 天
* 开始日期必须在最近一年范围内
* 返回的交易日不包括周末和节假日
* 市场代码不区分大小写

## 支持的市场

| 市场 | 示例 |
| - | - |
| 美股 | US |
| 港股 | HK |
| A股 | CN |

## 请求参数

| 参数名 | 是否必须 | 描述 |
| - | - | - |
| market | 是 | 市场代码，可选值：`US`、`HK`、`CN` |
| beg\_day | 是 | 开始日期，格式：YYYYMMDD，必须在最近一年范围内 |
| end\_day | 是 | 结束日期，格式：YYYYMMDD；与开始日期的范围最多为 31 天 |

## 返回字段说明

| 字段 | 说明 |
| - | - |
| market | 市场代码 |
| trade\_days | 全日交易日列表，使用 YYYYMMDD 格式 |
| half\_trade\_days | 半日交易日列表（仅半天交易），使用 YYYYMMDD 格式 |


## OpenAPI

````yaml openapi.yaml GET /v1/market/trade-days
openapi: 3.1.0
info:
  title: TickDB API
  description: TickDB 统一实时行情数据 API，提供 REST 和 WebSocket 接入。
  version: 1.0.3
  contact:
    email: support@tickdb.ai
servers:
  - url: https://api.tickdb.ai
    description: 生产环境
security:
  - ApiKeyAuth: []
paths:
  /v1/market/trade-days:
    get:
      summary: 交易日历
      description: 查询指定市场在特定时间范围内的交易日列表，用于判断某日是否为交易日。
      parameters:
        - name: market
          in: query
          required: true
          description: 市场代码，可选值：`US`、`HK`、`CN`
          schema:
            type: string
            enum:
              - US
              - HK
              - CN
            default: US
            example: US
        - name: beg_day
          in: query
          required: true
          description: 开始日期，格式：YYYYMMDD，必须在最近一年范围内
          schema:
            type: string
            pattern: ^[0-9]{8}$
            default: '20260201'
            example: '20260201'
        - name: end_day
          in: query
          required: true
          description: 结束日期，格式：YYYYMMDD；与开始日期的范围最多为 31 天
          schema:
            type: string
            pattern: ^[0-9]{8}$
            default: '20260228'
            example: '20260228'
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - data
                additionalProperties: false
                properties:
                  code:
                    type: integer
                    const: 0
                    example: 0
                  data:
                    type: object
                    required:
                      - market
                      - trade_days
                      - half_trade_days
                    additionalProperties: false
                    properties:
                      market:
                        type: string
                        enum:
                          - US
                          - HK
                          - CN
                      trade_days:
                        type: array
                        items:
                          type: string
                      half_trade_days:
                        type: array
                        items:
                          type: string
                    example:
                      market: US
                      trade_days:
                        - '20260202'
                        - '20260203'
                        - '20260204'
                        - '20260205'
                        - '20260206'
                        - '20260209'
                        - '20260210'
                        - '20260211'
                        - '20260212'
                        - '20260213'
                        - '20260217'
                        - '20260218'
                        - '20260219'
                        - '20260220'
                        - '20260223'
                        - '20260224'
                        - '20260225'
                        - '20260226'
                        - '20260227'
                      half_trade_days: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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