> ## 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 股、港股、美股） | ✅ |
| 企业版 | ✅ |

## 注意事项

* 返回的时间为各市场的**当地时间**

## 支持的市场

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

## 请求参数

| 参数名 | 是否必须 | 描述 |
| - | - | - |
| market | 否 | 市场代码，可选值：`US`、`HK`、`CN`；不传时返回全部支持市场 |

## 返回字段说明

| 字段 | 说明 |
| - | - |
| market | 市场（US - 美股市场，HK - 港股市场，CN - A股市场） |
| trading\_sessions | 交易时段数组 |
| └─ begin\_time | 交易开始时间，格式：hhmm，例如：900 |
| └─ end\_time | 交易结束时间，格式：hhmm，例如：1400 |
| └─ trade\_session | 交易时段类型（0 - 盘中交易，1 - 盘前交易，2 - 盘后交易，3 - 夜盘交易） |


## OpenAPI

````yaml openapi.yaml GET /v1/market/trading-sessions
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/trading-sessions:
    get:
      summary: 交易时段
      description: 查询一个或全部支持市场的交易时段信息，包括开盘时间、收盘时间等。
      parameters:
        - name: market
          in: query
          required: false
          description: 市场代码，可选值：`US`、`HK`、`CN`；不传时返回全部支持市场
          schema:
            type: string
            enum:
              - US
              - HK
              - CN
            example: US
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 0
                  message:
                    type: string
                    example: success
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        market:
                          type: string
                          enum:
                            - US
                            - HK
                            - CN
                        trading_sessions:
                          type: array
                          items:
                            type: object
                            properties:
                              begin_time:
                                type: integer
                              end_time:
                                type: integer
                              trade_session:
                                type: integer
                    example:
                      - market: US
                        trading_sessions:
                          - begin_time: 400
                            end_time: 930
                            trade_session: 1
                          - begin_time: 930
                            end_time: 1600
                          - begin_time: 1600
                            end_time: 2000
                            trade_session: 2
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.