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

# 批量查询实时行情



## OpenAPI

````yaml /zh-Hans/api-reference/openapi.json post /v1/quotes
openapi: 3.1.0
info:
  title: TickFlow 行情数据 API
  description: |-
    高性能行情数据服务，支持 A股、ETF、美股、港股。

    ## 认证方式

    所有接口需要通过 `x-api-key` 请求头传递 API Key 进行认证。

    ## 速率限制

    根据 API Key 配置的权限，可能会有请求频率和配额限制。

    ## 批量查询

    部分接口同时支持 GET 和 POST 方法：
    - **GET**: 通过 URL 参数传递，适合少量数据
    - **POST**: 通过 JSON Body 传递，适合大批量查询，不受 URL 长度限制

    ## K线周期

    支持的周期：1m, 5m, 10m, 15m, 30m, 60m, 1d, 1w, 1M, 1Q, 1Y
    - 日内周期(5m/15m/30m/60m)从1m数据聚合
    - 周线(1w)/月线(1M)/季线(1Q)/年线(1Y)从日线聚合
    - intraday 接口当前为 Beta 版本
  contact:
    name: TickFlow Team
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.tickflow.org
security:
  - api_key: []
paths:
  /v1/quotes:
    post:
      tags:
        - 实时行情
      summary: 批量查询实时行情
      operationId: post_quotes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuotesRequest'
        required: true
      responses:
        '200':
          description: 查询成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotesResponse'
        '400':
          description: 参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: 认证失败
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: 无权限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: 标的池不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - api_key: []
components:
  schemas:
    QuotesRequest:
      type: object
      description: 实时行情批量查询请求体 (POST)
      properties:
        symbols:
          type:
            - array
            - 'null'
          items:
            type: string
          description: 标的代码列表
          example:
            - 600000.SH
            - 000001.SZ
            - AAPL.US
        universes:
          type:
            - array
            - 'null'
          items:
            type: string
          description: 标的池 ID 列表
          example:
            - CN_Equity_A
            - CN_ETF
    QuotesResponse:
      type: object
      description: 实时行情响应
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Quote'
    ApiError:
      type: object
      description: API 错误响应体
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 错误代码 (如 "INVALID_PERIOD", "SYMBOL_NOT_FOUND")
          example: INVALID_PERIOD
        details:
          description: 详细信息 (可选，用于调试)
        message:
          type: string
          description: 错误消息 (人类可读)
          example: 'Invalid period: 2d'
    Quote:
      type: object
      description: 行情数据
      required:
        - symbol
        - region
        - last_price
        - prev_close
        - open
        - high
        - low
        - volume
        - amount
        - timestamp
      properties:
        amount:
          type: number
          format: double
          description: 成交额
        ext:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/QuoteExtension'
              description: 扩展数据
        high:
          type: number
          format: double
          description: 最高价
        last_price:
          type: number
          format: double
          description: 最新价
        low:
          type: number
          format: double
          description: 最低价
        open:
          type: number
          format: double
          description: 开盘价
        prev_close:
          type: number
          format: double
          description: 昨收价
        region:
          $ref: '#/components/schemas/Region'
          description: 地区
        session:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SessionStatus'
              description: 交易时段
        symbol:
          type: string
          description: 标的代码
        timestamp:
          type: integer
          format: int64
          description: 时间戳 (毫秒)
        volume:
          type: integer
          format: int64
          description: 成交量
    QuoteExtension:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/CnEquityQuoteExt'
              description: A股扩展数据
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - cn_equity
          description: A股扩展数据
        - allOf:
            - $ref: '#/components/schemas/UsEquityQuoteExt'
              description: 美股扩展数据
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - us_equity
          description: 美股扩展数据
        - allOf:
            - $ref: '#/components/schemas/HkEquityQuoteExt'
              description: 港股扩展数据
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - hk_equity
          description: 港股扩展数据
      description: |-
        地区特定的扩展数据

        `type` 标签值与 [`MarketType`] 一一对应。
    Region:
      type: string
      description: 支持的地区/市场
      enum:
        - CN
        - US
        - HK
    SessionStatus:
      type: string
      description: 交易时段状态
      enum:
        - pre_market
        - regular
        - after_hours
        - closed
        - halted
        - lunch_break
    CnEquityQuoteExt:
      type: object
      description: A股扩展数据（仅实时/计算字段，静态字段在 Instrument）
      properties:
        amplitude:
          type:
            - number
            - 'null'
          format: double
          description: 振幅 0.01 -> 1%
        change_amount:
          type:
            - number
            - 'null'
          format: double
          description: 涨跌额
        change_pct:
          type:
            - number
            - 'null'
          format: double
          description: 涨跌幅 0.01 -> 1%
        name:
          type:
            - string
            - 'null'
          description: 名称
        turnover_rate:
          type:
            - number
            - 'null'
          format: double
          description: 换手率 0.01 -> 1%
    UsEquityQuoteExt:
      type: object
      description: 美股扩展数据（与 A 股保持一致结构）
      properties:
        amplitude:
          type:
            - number
            - 'null'
          format: double
          description: 振幅 0.01 -> 1%
        change_amount:
          type:
            - number
            - 'null'
          format: double
          description: 涨跌额
        change_pct:
          type:
            - number
            - 'null'
          format: double
          description: 涨跌幅 0.01 -> 1%
        name:
          type:
            - string
            - 'null'
          description: 名称
        turnover_rate:
          type:
            - number
            - 'null'
          format: double
          description: 换手率 0.01 -> 1%
    HkEquityQuoteExt:
      type: object
      description: 港股扩展数据（与 A 股 / 美股保持一致结构）
      properties:
        amplitude:
          type:
            - number
            - 'null'
          format: double
          description: 振幅 0.01 -> 1%
        change_amount:
          type:
            - number
            - 'null'
          format: double
          description: 涨跌额
        change_pct:
          type:
            - number
            - 'null'
          format: double
          description: 涨跌幅 0.01 -> 1%
        name:
          type:
            - string
            - 'null'
          description: 名称
        turnover_rate:
          type:
            - number
            - 'null'
          format: double
          description: 换手率 0.01 -> 1%
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: x-api-key

````