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

# 交易日历

> 获取指定日期区间内的交易日列表

获取指定日期区间内的交易日列表（按日期升序），覆盖从上市初期至已公布的未来交易日。

<Note>
  支持的市场：`cn`（A 股，含上交所 `sh`、深交所 `sz`、北交所 `bj`）、`hk`（港股）、`us`（美股）。`global` 无日历源，传入会返回错误。
</Note>

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.reportify.cn/v1/quant/quotes/calendar?start_date=2026-01-01&end_date=2026-01-31" \
    -H "Authorization: Bearer <token>"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.reportify.cn/v1/quant/quotes/calendar",
      headers={"Authorization": "Bearer <token>"},
      params={
          "start_date": "2026-01-01",
          "end_date": "2026-01-31",
      }
  )
  print(response.json())
  ```

  ```typescript TypeScript theme={null}
  const params = new URLSearchParams({
    start_date: '2026-01-01',
    end_date: '2026-01-31'
  });

  const response = await fetch(
    `https://api.reportify.cn/v1/quant/quotes/calendar?${params}`,
    {
      headers: { 'Authorization': 'Bearer <token>' }
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

## 请求参数

<ParamField query="start_date" type="string">
  开始日期（`YYYY-MM-DD`），可选，默认当年 1 月 1 日
</ParamField>

<ParamField query="end_date" type="string">
  结束日期（`YYYY-MM-DD`），可选，默认当年 12 月 31 日
</ParamField>

<ParamField query="market" type="string" default="cn">
  股票市场，可选 `cn`/`hk`/`us`（`global` 不支持）
</ParamField>

<ParamField query="exchange" type="string">
  交易所。`cn`：`sh`（上交所）/`sz`（深交所）/`bj`（北交所）；`hk`：`hk`；`us`：`us`。不传时使用市场默认交易所（`cn` 为 `sh`）
</ParamField>

## 响应参数

<ResponseField name="datas" type="array">
  交易日列表（按日期升序）

  <Expandable title="数据字段">
    <ResponseField name="date" type="string">
      交易日（`YYYY-MM-DD`）
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="metadata" type="object">
  查询元数据，包含 `market`、`exchange`、`start_date`、`end_date`、`count`
</ResponseField>

## 响应示例

```json theme={null}
{
  "datas": [
    { "date": "2026-01-05" },
    { "date": "2026-01-06" },
    { "date": "2026-01-07" }
  ],
  "metadata": {
    "market": "cn",
    "exchange": "sh",
    "start_date": "2026-01-01",
    "end_date": "2026-01-31",
    "count": 20
  }
}
```


## OpenAPI

````yaml GET /v1/quant/quotes/calendar
openapi: 3.1.0
info:
  title: Reportify API
  version: 1.0.0
  description: API documentation for Reportify's document management and search services.
servers:
  - url: https://api.reportify.cn
    description: Production server
security:
  - BearerAuth: []
paths:
  /v1/quant/quotes/calendar:
    get:
      tags:
        - openapi-quant
      summary: List trading days in a date range
      description: >
        List trading days within [start_date, end_date] (inclusive).


        Supported markets: cn (sh/sz/bj), hk, us. The global market has no
        calendar source and returns an error.


        - **start_date**: Start date (optional, default: Jan 1 of the current
        year)

        - **end_date**: End date (optional, default: Dec 31 of the current year)

        - **market**: Stock market, default cn (cn/hk/us supported)

        - **exchange**: Exchange within the market -- cn: sh/sz/bj, hk: hk, us:
        us (optional, default: sh for cn)
      operationId: trade_calendar_list
      parameters:
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: Start Date
          example: '2026-01-01'
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: End Date
          example: '2026-01-31'
        - name: market
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/StockMarket'
            default: cn
        - name: exchange
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/StockExchange'
              - type: 'null'
            title: Exchange
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeCalendarOutput'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    StockMarket:
      type: string
      enum:
        - cn
        - hk
        - us
        - global
      title: StockMarket
      description: Stock market identifier
    StockExchange:
      type: string
      enum:
        - sh
        - sz
        - bj
        - hk
        - us
      title: StockExchange
      description: Exchange identifier (sh=上交所, sz=深交所, bj=北交所, hk=香港, us=美国)
    TradeCalendarOutput:
      type: object
      required:
        - datas
        - metadata
      properties:
        datas:
          type: array
          title: Datas
          description: |
            For the list endpoint: trading-day objects ({"date": "YYYY-MM-DD"}).
            For the check endpoint: a single object with is_trading_day and the
            previous/next trading days.
          items:
            type: object
            additionalProperties: true
        metadata:
          type: object
          title: Metadata
          description: Query metadata (market, exchange, range/target, count)
          additionalProperties: true
      title: TradeCalendarOutput
      description: Trading calendar response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your Bearer token

````