> ## 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/check?target=2026-01-01" \
    -H "Authorization: Bearer <token>"
  ```

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

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

  ```typescript TypeScript theme={null}
  const response = await fetch(
    'https://api.reportify.cn/v1/quant/quotes/calendar/check?target=2026-01-01',
    {
      headers: { 'Authorization': 'Bearer <token>' }
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

## 请求参数

<ParamField query="target" type="string">
  待判断日期（`YYYY-MM-DD`），可选，默认今天
</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>

    <ResponseField name="is_trading_day" type="boolean">
      是否为交易日
    </ResponseField>

    <ResponseField name="previous_trading_day" type="string">
      上一交易日（严格早于 `date`），无则为 `null`
    </ResponseField>

    <ResponseField name="next_trading_day" type="string">
      下一交易日（严格晚于 `date`），无则为 `null`
    </ResponseField>
  </Expandable>
</ResponseField>

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

## 响应示例

```json theme={null}
{
  "datas": [
    {
      "date": "2026-01-01",
      "is_trading_day": false,
      "previous_trading_day": "2025-12-31",
      "next_trading_day": "2026-01-05"
    }
  ],
  "metadata": {
    "market": "cn",
    "exchange": "sh",
    "target": "2026-01-01"
  }
}
```


## OpenAPI

````yaml GET /v1/quant/quotes/calendar/check
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/check:
    get:
      tags:
        - openapi-quant
      summary: Check if a date is a trading day
      description: >
        Inspect a single date against the trading calendar.


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


        - **target**: Date to check (optional, default: today)

        - **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)


        Returns whether target is a trading day, plus the previous and next
        trading days (both strictly relative to target).
      operationId: trade_calendar_check
      parameters:
        - name: target
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: Target
          example: '2026-01-01'
        - 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

````