> ## 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.

# Stream

> 统一推送接口，按频道（channel）订阅行情和市场深度。
支持频道: `quotes`（需 WebSocket 实时行情权限）、`depth`（需市场深度权限）。




## AsyncAPI

````yaml zh-Hans/api-reference/websocket.yaml stream
id: stream
title: Stream
description: |
  统一推送接口，按频道（channel）订阅行情和市场深度。
  支持频道: `quotes`（需 WebSocket 实时行情权限）、`depth`（需市场深度权限）。
servers:
  - id: production
    protocol: wss
    host: api.tickflow.org
    bindings: []
    variables: []
address: /v1/ws/stream
parameters: []
bindings: []
operations:
  - &ref_1
    id: streamSubscribe
    title: Stream subscribe
    description: 客户端按频道订阅
    type: receive
    messages:
      - &ref_7
        id: subscribeRequest
        contentType: application/json
        payload:
          - name: 订阅频道
            description: 按频道和标的列表订阅，订阅成功后推送缓存快照
            type: object
            properties:
              - name: op
                type: string
                description: 操作类型
                enumValues:
                  - subscribe
                required: true
              - name: channel
                type: string
                description: 频道名称
                enumValues:
                  - quotes
                  - depth
                required: true
              - name: symbols
                type: array
                description: 要订阅的标的代码列表
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            op:
              type: string
              enum:
                - subscribe
              description: 操作类型
              x-parser-schema-id: <anonymous-schema-2>
            channel:
              type: string
              enum:
                - quotes
                - depth
              description: 频道名称
              x-parser-schema-id: <anonymous-schema-3>
            symbols:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-5>
              description: 要订阅的标的代码列表
              x-parser-schema-id: <anonymous-schema-4>
          required:
            - op
            - channel
            - symbols
          examples:
            - op: subscribe
              channel: quotes
              symbols:
                - 600000.SH
                - 000001.SZ
            - op: subscribe
              channel: depth
              symbols:
                - 600000.SH
          x-parser-schema-id: <anonymous-schema-1>
        title: 订阅频道
        description: 按频道和标的列表订阅，订阅成功后推送缓存快照
        example: |-
          {
            "op": "subscribe",
            "channel": "quotes",
            "symbols": [
              "600000.SH",
              "000001.SZ"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribeRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: stream
  - &ref_2
    id: streamUnsubscribe
    title: Stream unsubscribe
    description: 客户端按频道退订
    type: receive
    messages:
      - &ref_8
        id: unsubscribeRequest
        contentType: application/json
        payload:
          - name: 退订频道
            description: 按频道退订指定标的
            type: object
            properties:
              - name: op
                type: string
                description: 操作类型
                enumValues:
                  - unsubscribe
                required: true
              - name: channel
                type: string
                description: 频道名称
                enumValues:
                  - quotes
                  - depth
                required: true
              - name: symbols
                type: array
                description: 要退订的标的代码列表
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            op:
              type: string
              enum:
                - unsubscribe
              description: 操作类型
              x-parser-schema-id: <anonymous-schema-7>
            channel:
              type: string
              enum:
                - quotes
                - depth
              description: 频道名称
              x-parser-schema-id: <anonymous-schema-8>
            symbols:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-10>
              description: 要退订的标的代码列表
              x-parser-schema-id: <anonymous-schema-9>
          required:
            - op
            - channel
            - symbols
          examples:
            - op: unsubscribe
              channel: depth
              symbols:
                - 600000.SH
          x-parser-schema-id: <anonymous-schema-6>
        title: 退订频道
        description: 按频道退订指定标的
        example: |-
          {
            "op": "unsubscribe",
            "channel": "depth",
            "symbols": [
              "600000.SH"
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: unsubscribeRequest
    bindings: []
    extensions: *ref_0
  - &ref_3
    id: streamReceiveSubscribed
    title: Stream receive subscribed
    description: 服务端返回频道订阅状态
    type: send
    messages:
      - &ref_9
        id: subscribedResponse
        contentType: application/json
        payload:
          - name: 频道订阅状态
            description: subscribe / unsubscribe 操作后返回该频道的完整订阅列表
            type: object
            properties:
              - name: op
                type: string
                description: 消息类型
                enumValues:
                  - subscribed
                required: true
              - name: channel
                type: string
                description: 频道名称
                enumValues:
                  - quotes
                  - depth
                required: true
              - name: symbols
                type: array
                description: 当前该频道已订阅的全部标的
                required: true
                properties:
                  - name: item
                    type: string
                    required: false
              - name: total
                type: integer
                description: 当前该频道已订阅标的总数
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            op:
              type: string
              enum:
                - subscribed
              description: 消息类型
              x-parser-schema-id: <anonymous-schema-12>
            channel:
              type: string
              enum:
                - quotes
                - depth
              description: 频道名称
              x-parser-schema-id: <anonymous-schema-13>
            symbols:
              type: array
              items:
                type: string
                x-parser-schema-id: <anonymous-schema-15>
              description: 当前该频道已订阅的全部标的
              x-parser-schema-id: <anonymous-schema-14>
            total:
              type: integer
              description: 当前该频道已订阅标的总数
              x-parser-schema-id: <anonymous-schema-16>
          required:
            - op
            - channel
            - symbols
            - total
          examples:
            - op: subscribed
              channel: quotes
              symbols:
                - 600000.SH
                - 000001.SZ
              total: 2
          x-parser-schema-id: <anonymous-schema-11>
        title: 频道订阅状态
        description: subscribe / unsubscribe 操作后返回该频道的完整订阅列表
        example: |-
          {
            "op": "subscribed",
            "channel": "quotes",
            "symbols": [
              "600000.SH",
              "000001.SZ"
            ],
            "total": 2
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribedResponse
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: streamReceiveQuotes
    title: Stream receive quotes
    description: 服务端推送实时行情
    type: send
    messages:
      - &ref_10
        id: quotesData
        contentType: application/json
        payload:
          - name: 行情推送
            description: 实时行情数据，仅包含已订阅且有更新的标的
            type: object
            properties:
              - name: op
                type: string
                description: 消息类型
                enumValues:
                  - quotes
                required: true
              - name: data
                type: array
                description: 行情快照列表
                required: true
                properties:
                  - name: symbol
                    type: string
                    description: 标的代码
                    required: true
                  - name: region
                    type: string
                    description: 市场区域
                    enumValues:
                      - CN
                      - US
                      - HK
                    required: true
                  - name: last_price
                    type: number
                    description: 最新价
                    required: true
                  - name: prev_close
                    type: number
                    description: 昨收价
                    required: true
                  - name: open
                    type: number
                    description: 开盘价
                    required: true
                  - name: high
                    type: number
                    description: 最高价
                    required: true
                  - name: low
                    type: number
                    description: 最低价
                    required: true
                  - name: volume
                    type: integer
                    description: 成交量
                    required: true
                  - name: amount
                    type: number
                    description: 成交额
                    required: true
                  - name: timestamp
                    type: integer
                    description: 行情时间戳（毫秒）
                    required: true
                  - name: session
                    type: string
                    description: 交易时段（可选）
                    required: false
                  - name: ext
                    type: object
                    description: 扩展数据（名称、涨跌幅等，可选）
                    required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            op:
              type: string
              enum:
                - quotes
              description: 消息类型
              x-parser-schema-id: <anonymous-schema-18>
            data:
              type: array
              items:
                type: object
                additionalProperties: true
                description: 单条行情快照
                properties:
                  symbol:
                    type: string
                    example: 600000.SH
                    description: 标的代码
                    x-parser-schema-id: <anonymous-schema-20>
                  region:
                    type: string
                    enum:
                      - CN
                      - US
                      - HK
                    example: CN
                    description: 市场区域
                    x-parser-schema-id: <anonymous-schema-21>
                  last_price:
                    type: number
                    example: 9.72
                    description: 最新价
                    x-parser-schema-id: <anonymous-schema-22>
                  prev_close:
                    type: number
                    example: 9.78
                    description: 昨收价
                    x-parser-schema-id: <anonymous-schema-23>
                  open:
                    type: number
                    example: 9.78
                    description: 开盘价
                    x-parser-schema-id: <anonymous-schema-24>
                  high:
                    type: number
                    example: 9.78
                    description: 最高价
                    x-parser-schema-id: <anonymous-schema-25>
                  low:
                    type: number
                    example: 9.68
                    description: 最低价
                    x-parser-schema-id: <anonymous-schema-26>
                  volume:
                    type: integer
                    example: 426585
                    description: 成交量
                    x-parser-schema-id: <anonymous-schema-27>
                  amount:
                    type: number
                    example: 422430500
                    description: 成交额
                    x-parser-schema-id: <anonymous-schema-28>
                  timestamp:
                    type: integer
                    example: 1776754802000
                    description: 行情时间戳（毫秒）
                    x-parser-schema-id: <anonymous-schema-29>
                  session:
                    type: string
                    example: trading
                    description: 交易时段（可选）
                    x-parser-schema-id: <anonymous-schema-30>
                  ext:
                    type: object
                    description: 扩展数据（名称、涨跌幅等，可选）
                    x-parser-schema-id: <anonymous-schema-31>
                required:
                  - symbol
                  - region
                  - last_price
                  - prev_close
                  - open
                  - high
                  - low
                  - volume
                  - amount
                  - timestamp
                x-parser-schema-id: Quote
              description: 行情快照列表
              x-parser-schema-id: <anonymous-schema-19>
          required:
            - op
            - data
          examples:
            - op: quotes
              data:
                - symbol: 600000.SH
                  region: CN
                  last_price: 9.72
                  prev_close: 9.78
                  open: 9.78
                  high: 9.78
                  low: 9.68
                  volume: 426585
                  amount: 422430500
                  timestamp: 1776754802000
                  ext:
                    type: cn_equity
                    name: 浦发银行
                    change_pct: -0.006135
                    change_amount: -0.06
                    amplitude: 0.010225
                    turnover_rate: 0.001281
          x-parser-schema-id: <anonymous-schema-17>
        title: 行情推送
        description: 实时行情数据，仅包含已订阅且有更新的标的
        example: |-
          {
            "op": "quotes",
            "data": [
              {
                "symbol": "600000.SH",
                "region": "CN",
                "last_price": 9.72,
                "prev_close": 9.78,
                "open": 9.78,
                "high": 9.78,
                "low": 9.68,
                "volume": 426585,
                "amount": 422430500,
                "timestamp": 1776754802000,
                "ext": {
                  "type": "cn_equity",
                  "name": "浦发银行",
                  "change_pct": -0.006135,
                  "change_amount": -0.06,
                  "amplitude": 0.010225,
                  "turnover_rate": 0.001281
                }
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: quotesData
    bindings: []
    extensions: *ref_0
  - &ref_5
    id: streamReceiveDepth
    title: Stream receive depth
    description: 服务端推送市场深度
    type: send
    messages:
      - &ref_11
        id: depthData
        contentType: application/json
        payload:
          - name: 市场深度推送
            description: 五档盘口数据，仅包含已订阅 depth 频道且有更新的标的
            type: object
            properties:
              - name: op
                type: string
                description: 消息类型
                enumValues:
                  - depth
                required: true
              - name: data
                type: array
                description: 市场深度列表
                required: true
                properties:
                  - name: symbol
                    type: string
                    description: 标的代码
                    required: true
                  - name: region
                    type: string
                    description: 市场区域
                    enumValues:
                      - CN
                      - US
                      - HK
                    required: true
                  - name: timestamp
                    type: integer
                    description: 时间戳（毫秒）
                    required: true
                  - name: bid_prices
                    type: array
                    description: 买入价（买1-买5，降序）
                    required: true
                    properties:
                      - name: item
                        type: number
                        required: false
                  - name: bid_volumes
                    type: array
                    description: 买入量
                    required: true
                    properties:
                      - name: item
                        type: integer
                        required: false
                  - name: ask_prices
                    type: array
                    description: 卖出价（卖1-卖5，升序）
                    required: true
                    properties:
                      - name: item
                        type: number
                        required: false
                  - name: ask_volumes
                    type: array
                    description: 卖出量
                    required: true
                    properties:
                      - name: item
                        type: integer
                        required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            op:
              type: string
              enum:
                - depth
              description: 消息类型
              x-parser-schema-id: <anonymous-schema-33>
            data:
              type: array
              items:
                type: object
                description: 单条五档市场深度
                properties:
                  symbol:
                    type: string
                    example: 600000.SH
                    description: 标的代码
                    x-parser-schema-id: <anonymous-schema-35>
                  region:
                    type: string
                    enum:
                      - CN
                      - US
                      - HK
                    example: CN
                    description: 市场区域
                    x-parser-schema-id: <anonymous-schema-36>
                  timestamp:
                    type: integer
                    example: 1776754802000
                    description: 时间戳（毫秒）
                    x-parser-schema-id: <anonymous-schema-37>
                  bid_prices:
                    type: array
                    items:
                      type: number
                      x-parser-schema-id: <anonymous-schema-39>
                    example:
                      - 9.72
                      - 9.71
                      - 9.7
                      - 9.69
                      - 9.68
                    description: 买入价（买1-买5，降序）
                    x-parser-schema-id: <anonymous-schema-38>
                  bid_volumes:
                    type: array
                    items:
                      type: integer
                      x-parser-schema-id: <anonymous-schema-41>
                    example:
                      - 3192
                      - 3870
                      - 26168
                      - 5849
                      - 5480
                    description: 买入量
                    x-parser-schema-id: <anonymous-schema-40>
                  ask_prices:
                    type: array
                    items:
                      type: number
                      x-parser-schema-id: <anonymous-schema-43>
                    example:
                      - 9.73
                      - 9.74
                      - 9.75
                      - 9.76
                      - 9.77
                    description: 卖出价（卖1-卖5，升序）
                    x-parser-schema-id: <anonymous-schema-42>
                  ask_volumes:
                    type: array
                    items:
                      type: integer
                      x-parser-schema-id: <anonymous-schema-45>
                    example:
                      - 74
                      - 1602
                      - 1148
                      - 1209
                      - 1109
                    description: 卖出量
                    x-parser-schema-id: <anonymous-schema-44>
                required:
                  - symbol
                  - region
                  - timestamp
                  - bid_prices
                  - bid_volumes
                  - ask_prices
                  - ask_volumes
                x-parser-schema-id: MarketDepth
              description: 市场深度列表
              x-parser-schema-id: <anonymous-schema-34>
          required:
            - op
            - data
          examples:
            - op: depth
              data:
                - symbol: 600000.SH
                  region: CN
                  timestamp: 1776754802000
                  bid_prices:
                    - 9.72
                    - 9.71
                    - 9.7
                    - 9.69
                    - 9.68
                  bid_volumes:
                    - 3192
                    - 3870
                    - 26168
                    - 5849
                    - 5480
                  ask_prices:
                    - 9.73
                    - 9.74
                    - 9.75
                    - 9.76
                    - 9.77
                  ask_volumes:
                    - 74
                    - 1602
                    - 1148
                    - 1209
                    - 1109
          x-parser-schema-id: <anonymous-schema-32>
        title: 市场深度推送
        description: 五档盘口数据，仅包含已订阅 depth 频道且有更新的标的
        example: |-
          {
            "op": "depth",
            "data": [
              {
                "symbol": "600000.SH",
                "region": "CN",
                "timestamp": 1776754802000,
                "bid_prices": [
                  9.72,
                  9.71,
                  9.7,
                  9.69,
                  9.68
                ],
                "bid_volumes": [
                  3192,
                  3870,
                  26168,
                  5849,
                  5480
                ],
                "ask_prices": [
                  9.73,
                  9.74,
                  9.75,
                  9.76,
                  9.77
                ],
                "ask_volumes": [
                  74,
                  1602,
                  1148,
                  1209,
                  1109
                ]
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: depthData
    bindings: []
    extensions: *ref_0
  - &ref_6
    id: streamReceiveError
    title: Stream receive error
    description: 服务端返回错误
    type: send
    messages:
      - &ref_12
        id: errorResponse
        contentType: application/json
        payload:
          - name: 错误消息
            description: 操作失败时返回的错误信息
            type: object
            properties:
              - name: op
                type: string
                description: 消息类型
                enumValues:
                  - error
                required: true
              - name: message
                type: string
                description: 错误详情
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            op:
              type: string
              enum:
                - error
              description: 消息类型
              x-parser-schema-id: <anonymous-schema-47>
            message:
              type: string
              description: 错误详情
              x-parser-schema-id: <anonymous-schema-48>
          required:
            - op
            - message
          examples:
            - op: error
              message: 'no permission for channel: depth'
            - op: error
              message: 'exceeded max 50 symbols (total unique: 53)'
            - op: error
              message: 'unknown channel: foo'
            - op: error
              message: 'invalid message: expected value at line 1 column 1'
          x-parser-schema-id: <anonymous-schema-46>
        title: 错误消息
        description: 操作失败时返回的错误信息
        example: |-
          {
            "op": "error",
            "message": "no permission for channel: depth"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: errorResponse
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
  - *ref_2
receiveOperations:
  - *ref_3
  - *ref_4
  - *ref_5
  - *ref_6
sendMessages:
  - *ref_7
  - *ref_8
receiveMessages:
  - *ref_9
  - *ref_10
  - *ref_11
  - *ref_12
extensions:
  - id: x-parser-unique-object-id
    value: stream
securitySchemes:
  - id: apiKey
    name: api_key
    type: httpApiKey
    in: query
    extensions: []

````