openapi: 3.0.2
info:
  title: Stocks Trading WebSocket Streams
  description: Binance 股票交易的 WebSocket 流定义。基础 URL：wss://nbstream.binance.com/equity
  version: 1.0.0
  termsOfService: https://www.binance.com/en/terms
  contact:
    name: Binance API Support
    url: https://www.binance.com/en/support
x-product-type: ws-streams
externalDocs:
  description: Stocks WebSocket Streams docs
  url: https://developers.binance.com/en/docs/products/stocks/websocket-streams-general-info
tags:
  - name: market-streams
    x-displayName: 行情流
  - name: user-streams
    x-displayName: 用户流
servers:
  - url: wss://nbstream.binance.com/equity
paths:
  /ws/price:
    post:
      summary: 价格流
      description: 全量价格快照，每 3 秒推送一次。每条消息包含所有活跃美股 symbol 的最新价格。
      tags:
        - market-streams
      operationId: priceStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/market-streams#price-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/MarketStreamsApi/priceStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/market_streams_api/price_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/MarketStreams/price_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/marketstreams/PriceStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//MarketStreamsAPI/PriceStream/PriceStream.go
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/price
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/price
              id: '1'
      responses:
        Raw Stream:
          description: 价格流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: price
                    description: 事件类型，固定为 `"price"`。
                  rates:
                    type: array
                    description: 每个 symbol 一条记录。
                    items:
                      type: object
                      properties:
                        s:
                          type: string
                          example: AAPL
                          description: Symbol（大写 ticker），例如 `"AAPL"`。
                        ac:
                          type: string
                          example: EQ_AAPL
                          description: 内部资产代码 `EQ_{symbol}`，仅供参考，不用作交易标识符。
                        p:
                          type: string
                          example: '182.5'
                          description: 最新价格，末尾零已去除。
                        t:
                          type: integer
                          format: int64
                          nullable: true
                          example: 1710320400000
                          description: 价格时间（UTC epoch 毫秒），可能为 null。
                        pc:
                          type: string
                          example: '181.2000'
                          description: 前一交易日 RTH 收盘价（参考值），不可知时不存在。
                        tc:
                          type: string
                          example: '182.0000'
                          description: 今日 RTH 收盘价，盘后前不存在。
                        mp:
                          type: string
                          example: O
                          enum:
                            - C
                            - true
                            - PRE
                            - O
                            - POST
                          description: 每 symbol 市场阶段：`C` 已收市、`ON` 夜盘、`PRE` 盘前、`O` 盘中、`POST` 盘后。
              example:
                e: price
                rates:
                  - s: AAPL
                    ac: EQ_AAPL
                    p: '182.5'
                    t: 1710320400000
                    pc: '181.2000'
                    tc: '182.0000'
                    mp: O
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/price
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: price
                        description: 事件类型，固定为 `"price"`。
                      rates:
                        type: array
                        description: 每个 symbol 一条记录。
                        items:
                          type: object
                          properties:
                            s:
                              type: string
                              example: AAPL
                              description: Symbol（大写 ticker），例如 `"AAPL"`。
                            ac:
                              type: string
                              example: EQ_AAPL
                              description: 内部资产代码 `EQ_{symbol}`，仅供参考，不用作交易标识符。
                            p:
                              type: string
                              example: '182.5'
                              description: 最新价格，末尾零已去除。
                            t:
                              type: integer
                              format: int64
                              nullable: true
                              example: 1710320400000
                              description: 价格时间（UTC epoch 毫秒），可能为 null。
                            pc:
                              type: string
                              example: '181.2000'
                              description: 前一交易日 RTH 收盘价（参考值），不可知时不存在。
                            tc:
                              type: string
                              example: '182.0000'
                              description: 今日 RTH 收盘价，盘后前不存在。
                            mp:
                              type: string
                              example: O
                              enum:
                                - C
                                - true
                                - PRE
                                - O
                                - POST
                              description: 每 symbol 市场阶段：`C` 已收市、`ON` 夜盘、`PRE` 盘前、`O` 盘中、`POST` 盘后。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/price
                data:
                  e: price
                  rates:
                    - s: AAPL
                      ac: EQ_AAPL
                      p: '182.5'
                      t: 1710320400000
                      pc: '181.2000'
                      tc: '182.0000'
                      mp: O
  /ws/{symbol}@quote:
    post:
      summary: 报价流
      description: 每个 symbol 的实时最优买一 / 卖一报价，每只 symbol 独立 stream。每 symbol 限速：每 200 ms 最多推送一次。
      tags:
        - market-streams
      operationId: quoteStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/market-streams#quote-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/MarketStreamsApi/quoteStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/market_streams_api/quote_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/MarketStreams/quote_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/marketstreams/QuoteStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//MarketStreamsAPI/QuoteStream/QuoteStream.go
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
            example: AAPL
          description: 美股 ticker（大写），如 `AAPL`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/aapl@quote
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/aapl@quote
              id: '1'
      responses:
        Raw Stream:
          description: 报价流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: quote
                    description: 事件类型，固定为 `"quote"`。
                  E:
                    type: integer
                    format: int64
                    example: 1710320400000
                    description: 事件时间——服务端推送消息时的 epoch 毫秒数。
                  s:
                    type: string
                    example: AAPL
                    description: Symbol（大写 ticker），例如 `"AAPL"`。
                  bp:
                    type: string
                    example: '182.50'
                    description: 最优买一价。
                  ap:
                    type: string
                    example: '182.55'
                    description: 最优卖一价。
                  bs:
                    type: integer
                    example: 100
                    description: 最优买一量（股数）。
                  as:
                    type: integer
                    example: 200
                    description: 最优卖一量（股数）。
                  T:
                    type: integer
                    format: int64
                    nullable: true
                    example: 1710320399500
                    description: 上游报价时间戳（epoch 毫秒），可能为 null。
              example:
                e: quote
                E: 1710320400000
                s: AAPL
                bp: '182.50'
                ap: '182.55'
                bs: 100
                as: 200
                T: 1710320399500
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/aapl@quote
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: quote
                        description: 事件类型，固定为 `"quote"`。
                      E:
                        type: integer
                        format: int64
                        example: 1710320400000
                        description: 事件时间——服务端推送消息时的 epoch 毫秒数。
                      s:
                        type: string
                        example: AAPL
                        description: Symbol（大写 ticker），例如 `"AAPL"`。
                      bp:
                        type: string
                        example: '182.50'
                        description: 最优买一价。
                      ap:
                        type: string
                        example: '182.55'
                        description: 最优卖一价。
                      bs:
                        type: integer
                        example: 100
                        description: 最优买一量（股数）。
                      as:
                        type: integer
                        example: 200
                        description: 最优卖一量（股数）。
                      T:
                        type: integer
                        format: int64
                        nullable: true
                        example: 1710320399500
                        description: 上游报价时间戳（epoch 毫秒），可能为 null。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/aapl@quote
                data:
                  e: quote
                  E: 1710320400000
                  s: AAPL
                  bp: '182.50'
                  ap: '182.55'
                  bs: 100
                  as: 200
                  T: 1710320399500
  /ws/{symbol}@kline_{interval}:
    post:
      summary: K 线流
      description: 每个 symbol 的 K 线更新，每个（symbol, 周期）组合一个 stream。支持周期：5m、1h、1d、1w、1M。
      tags:
        - market-streams
      operationId: klineStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/market-streams#kline-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/MarketStreamsApi/klineStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/market_streams_api/kline_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/MarketStreams/kline_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/marketstreams/KlineStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//MarketStreamsAPI/KlineStream/KlineStream.go
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
            example: AAPL
          description: 美股 ticker（大写），如 `AAPL`。
        - name: interval
          in: path
          required: true
          schema:
            type: string
            example: 5m
          description: K 线周期——`5m` / `1h` / `1d` / `1w` / `1M`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/aapl@kline_5m
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/aapl@kline_5m
              id: '1'
      responses:
        Raw Stream:
          description: K 线流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: kline
                    description: 事件类型，固定为 `"kline"`。
                  E:
                    type: integer
                    format: int64
                    example: 1710320400000
                    description: 事件时间（epoch 毫秒），服务端推送消息时的系统时间。
                  s:
                    type: string
                    example: AAPL
                    description: Symbol（大写 ticker）。
                  k:
                    type: object
                    description: K 线数据。
                    properties:
                      t:
                        type: integer
                        format: int64
                        example: 1710316800000
                        description: 开盘时间（epoch 毫秒）。
                      ct:
                        type: integer
                        format: int64
                        example: 1710317099999
                        description: 收盘时间（epoch 毫秒）。固定周期：`openTime + 时长 − 1ms`；`1M`：当月最后一天 23:59:59.999 UTC。
                      s:
                        type: string
                        example: AAPL
                        description: Symbol（大写 ticker）。
                      i:
                        type: string
                        example: 5m
                        enum:
                          - 5m
                          - 1h
                          - 1d
                          - 1w
                          - 1M
                        description: 周期——`"5m"` / `"1h"` / `"1d"` / `"1w"` / `"1M"`。
                      o:
                        type: string
                        example: '182.50'
                        description: 开盘价。
                      c:
                        type: string
                        example: '183.20'
                        description: 收盘价（区间内最新成交价）。
                      h:
                        type: string
                        example: '183.50'
                        description: 最高价。
                      l:
                        type: string
                        example: '182.30'
                        description: 最低价。
                      v:
                        type: string
                        example: '15000'
                        description: 成交量（股数），默认 `"0"`。
                      'n':
                        type: integer
                        nullable: true
                        example: 120
                        description: 成交笔数，上游未填充时不存在。
                      x:
                        type: boolean
                        example: false
                        description: K 线是否已收盘——区间结束后为 `true`。
                      vw:
                        type: string
                        nullable: true
                        example: '182.95'
                        description: VWAP（成交量加权平均价），上游未填充时不存在。
              example:
                e: kline
                E: 1710320400000
                s: AAPL
                k:
                  t: 1710316800000
                  ct: 1710317099999
                  s: AAPL
                  i: 5m
                  o: '182.50'
                  c: '183.20'
                  h: '183.50'
                  l: '182.30'
                  v: '15000'
                  'n': 120
                  x: false
                  vw: '182.95'
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/aapl@kline_5m
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: kline
                        description: 事件类型，固定为 `"kline"`。
                      E:
                        type: integer
                        format: int64
                        example: 1710320400000
                        description: 事件时间（epoch 毫秒），服务端推送消息时的系统时间。
                      s:
                        type: string
                        example: AAPL
                        description: Symbol（大写 ticker）。
                      k:
                        type: object
                        description: K 线数据。
                        properties:
                          t:
                            type: integer
                            format: int64
                            example: 1710316800000
                            description: 开盘时间（epoch 毫秒）。
                          ct:
                            type: integer
                            format: int64
                            example: 1710317099999
                            description: 收盘时间（epoch 毫秒）。固定周期：`openTime + 时长 − 1ms`；`1M`：当月最后一天 23:59:59.999 UTC。
                          s:
                            type: string
                            example: AAPL
                            description: Symbol（大写 ticker）。
                          i:
                            type: string
                            example: 5m
                            enum:
                              - 5m
                              - 1h
                              - 1d
                              - 1w
                              - 1M
                            description: 周期——`"5m"` / `"1h"` / `"1d"` / `"1w"` / `"1M"`。
                          o:
                            type: string
                            example: '182.50'
                            description: 开盘价。
                          c:
                            type: string
                            example: '183.20'
                            description: 收盘价（区间内最新成交价）。
                          h:
                            type: string
                            example: '183.50'
                            description: 最高价。
                          l:
                            type: string
                            example: '182.30'
                            description: 最低价。
                          v:
                            type: string
                            example: '15000'
                            description: 成交量（股数），默认 `"0"`。
                          'n':
                            type: integer
                            nullable: true
                            example: 120
                            description: 成交笔数，上游未填充时不存在。
                          x:
                            type: boolean
                            example: false
                            description: K 线是否已收盘——区间结束后为 `true`。
                          vw:
                            type: string
                            nullable: true
                            example: '182.95'
                            description: VWAP（成交量加权平均价），上游未填充时不存在。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/aapl@kline_5m
                data:
                  e: kline
                  E: 1710320400000
                  s: AAPL
                  k:
                    t: 1710316800000
                    ct: 1710317099999
                    s: AAPL
                    i: 5m
                    o: '182.50'
                    c: '183.20'
                    h: '183.50'
                    l: '182.30'
                    v: '15000'
                    'n': 120
                    x: false
                    vw: '182.95'
  /ws/calendar:
    post:
      summary: 日历流
      description: 广播市场阶段切换事件，每次切换推送一条消息，无定时心跳。服务端每 5 秒轮询一次。
      tags:
        - market-streams
      operationId: calendarStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/market-streams#calendar-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/MarketStreamsApi/calendarStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/market_streams_api/calendar_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/MarketStreams/calendar_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/marketstreams/CalendarStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//MarketStreamsAPI/CalendarStream/CalendarStream.go
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/calendar
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/calendar
              id: '1'
      responses:
        Raw Stream:
          description: 日历流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: calendar
                    description: 事件类型，固定为 `"calendar"`。
                  from:
                    type: string
                    example: PRE_MARKET
                    enum:
                      - MARKET_CLOSED
                      - OVERNIGHT
                      - PRE_MARKET
                      - MARKET_OPEN
                      - POST_MARKET
                    description: 切换前的市场阶段。
                  to:
                    type: string
                    example: MARKET_OPEN
                    enum:
                      - MARKET_CLOSED
                      - OVERNIGHT
                      - PRE_MARKET
                      - MARKET_OPEN
                      - POST_MARKET
                    description: 切换后的新市场阶段。
                  ts:
                    type: integer
                    format: int64
                    example: 1710334200000
                    description: 切换被检测到时的事件时间戳（UTC epoch 毫秒）。
              example:
                e: calendar
                from: PRE_MARKET
                to: MARKET_OPEN
                ts: 1710334200000
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/calendar
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: calendar
                        description: 事件类型，固定为 `"calendar"`。
                      from:
                        type: string
                        example: PRE_MARKET
                        enum:
                          - MARKET_CLOSED
                          - OVERNIGHT
                          - PRE_MARKET
                          - MARKET_OPEN
                          - POST_MARKET
                        description: 切换前的市场阶段。
                      to:
                        type: string
                        example: MARKET_OPEN
                        enum:
                          - MARKET_CLOSED
                          - OVERNIGHT
                          - PRE_MARKET
                          - MARKET_OPEN
                          - POST_MARKET
                        description: 切换后的新市场阶段。
                      ts:
                        type: integer
                        format: int64
                        example: 1710334200000
                        description: 切换被检测到时的事件时间戳（UTC epoch 毫秒）。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/calendar
                data:
                  e: calendar
                  from: PRE_MARKET
                  to: MARKET_OPEN
                  ts: 1710334200000
  /ws/{symbol}@tradability:
    post:
      summary: 可交易方向流
      description: 每当 symbol 的可交易方向发生变化时推送。仅在值实际变化时推送（新值 ≠ 旧值）。
      tags:
        - market-streams
      operationId: tradabilityStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/market-streams#tradability-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/MarketStreamsApi/tradabilityStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/market_streams_api/tradability_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/MarketStreams/tradability_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/marketstreams/TradabilityStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//MarketStreamsAPI/TradabilityStream/TradabilityStream.go
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
            example: AAPL
          description: 美股 ticker（大写），如 `AAPL`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/aapl@tradability
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/aapl@tradability
              id: '1'
      responses:
        Raw Stream:
          description: 可交易方向流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: tradability
                    description: 事件类型，固定为 `"tradability"`。
                  symbol:
                    type: string
                    example: AAPL
                    description: Symbol（大写 ticker）。
                  assetCode:
                    type: string
                    nullable: true
                    example: EQ_AAPL
                    description: 内部资产代码 `EQ_{symbol}`，仅供参考。对尚未加入 symbol 字典的 symbol 可能为 null。
                  tradability:
                    type: string
                    example: BUY_SELL
                    enum:
                      - BUY_SELL
                      - BUY
                      - SELL
                      - NONE
                      - OFFMARKET
                      - DELISTING
                    description: 新的可交易方向值。`OFFMARKET` 和 `DELISTING` 为保护状态——交易状态事件不能将 symbol 从这两个状态转出。
                  t:
                    type: integer
                    format: int64
                    example: 1712345678000
                    description: 推送时间（UTC epoch 毫秒）。
              example:
                e: tradability
                symbol: AAPL
                assetCode: EQ_AAPL
                tradability: BUY_SELL
                t: 1712345678000
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/aapl@tradability
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: tradability
                        description: 事件类型，固定为 `"tradability"`。
                      symbol:
                        type: string
                        example: AAPL
                        description: Symbol（大写 ticker）。
                      assetCode:
                        type: string
                        nullable: true
                        example: EQ_AAPL
                        description: 内部资产代码 `EQ_{symbol}`，仅供参考。对尚未加入 symbol 字典的 symbol 可能为 null。
                      tradability:
                        type: string
                        example: BUY_SELL
                        enum:
                          - BUY_SELL
                          - BUY
                          - SELL
                          - NONE
                          - OFFMARKET
                          - DELISTING
                        description: 新的可交易方向值。`OFFMARKET` 和 `DELISTING` 为保护状态——交易状态事件不能将 symbol 从这两个状态转出。
                      t:
                        type: integer
                        format: int64
                        example: 1712345678000
                        description: 推送时间（UTC epoch 毫秒）。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/aapl@tradability
                data:
                  e: tradability
                  symbol: AAPL
                  assetCode: EQ_AAPL
                  tradability: BUY_SELL
                  t: 1712345678000
  /ws/{symbol}@tradingStatus:
    post:
      summary: 交易状态流
      description: 每个 symbol 的交易状态切换（停牌、恢复、SSR、LULD 暂停等）。不符合已知状态 / 原因规则的事件不推送。
      tags:
        - market-streams
      operationId: tradingStatusStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/market-streams#trading-status-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/MarketStreamsApi/tradingStatusStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/market_streams_api/trading_status_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/MarketStreams/trading_status_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/marketstreams/TradingStatusStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//MarketStreamsAPI/TradingStatusStream/TradingStatusStream.go
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
            example: AAPL
          description: 美股 ticker（大写），如 `AAPL`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/aapl@tradingStatus
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/aapl@tradingStatus
              id: '1'
      responses:
        Raw Stream:
          description: 交易状态流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: tradingStatus
                    description: 事件类型，固定为 `"tradingStatus"`。
                  symbol:
                    type: string
                    example: AAPL
                    description: Symbol（大写 ticker），例如 `"AAPL"`。
                  assetCode:
                    type: string
                    example: EQ_AAPL
                    description: 内部资产代码 `EQ_{symbol}`，仅供参考。
                  status:
                    type: string
                    example: TRADING_HALTED
                    enum:
                      - TRADING_HALTED
                      - TRADING_PAUSED
                      - SHORT_SALE_RESTRICTED
                      - TRADING_RESUMED
                      - QUOTATION_RESUMED
                      - TRADING_SUSPENDED
                      - UNAVAILABLE
                    description: 交易状态。
                  msg:
                    type: string
                    example: MATERIAL_NEWS
                    description: 原因码。
                  time:
                    type: integer
                    format: int64
                    example: 1614021300000
                    description: 状态生效时间（UTC epoch 毫秒），可能是未来时间。
                  z:
                    type: string
                    example: C
                    enum:
                      - C
                      - 'N'
                    description: Tape 标识：`C` = CTA（NYSE / AMEX），`N` = UTP（Nasdaq）。
                  tradability:
                    type: string
                    example: NONE
                    enum:
                      - BUY_SELL
                      - BUY
                      - SELL
                      - NONE
                    description: 状态变化后的可交易方向：`BUY_SELL` / `BUY` / `SELL` / `NONE`。
              example:
                e: tradingStatus
                symbol: AAPL
                assetCode: EQ_AAPL
                status: TRADING_HALTED
                msg: MATERIAL_NEWS
                time: 1614021300000
                z: C
                tradability: NONE
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/aapl@tradingStatus
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: tradingStatus
                        description: 事件类型，固定为 `"tradingStatus"`。
                      symbol:
                        type: string
                        example: AAPL
                        description: Symbol（大写 ticker），例如 `"AAPL"`。
                      assetCode:
                        type: string
                        example: EQ_AAPL
                        description: 内部资产代码 `EQ_{symbol}`，仅供参考。
                      status:
                        type: string
                        example: TRADING_HALTED
                        enum:
                          - TRADING_HALTED
                          - TRADING_PAUSED
                          - SHORT_SALE_RESTRICTED
                          - TRADING_RESUMED
                          - QUOTATION_RESUMED
                          - TRADING_SUSPENDED
                          - UNAVAILABLE
                        description: 交易状态。
                      msg:
                        type: string
                        example: MATERIAL_NEWS
                        description: 原因码。
                      time:
                        type: integer
                        format: int64
                        example: 1614021300000
                        description: 状态生效时间（UTC epoch 毫秒），可能是未来时间。
                      z:
                        type: string
                        example: C
                        enum:
                          - C
                          - 'N'
                        description: Tape 标识：`C` = CTA（NYSE / AMEX），`N` = UTP（Nasdaq）。
                      tradability:
                        type: string
                        example: NONE
                        enum:
                          - BUY_SELL
                          - BUY
                          - SELL
                          - NONE
                        description: 状态变化后的可交易方向：`BUY_SELL` / `BUY` / `SELL` / `NONE`。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/aapl@tradingStatus
                data:
                  e: tradingStatus
                  symbol: AAPL
                  assetCode: EQ_AAPL
                  status: TRADING_HALTED
                  msg: MATERIAL_NEWS
                  time: 1614021300000
                  z: C
                  tradability: NONE
  /ws/{listenKey}@orderReport:
    post:
      summary: 订单回报流
      description: 实时推送认证用户的订单状态变化——包括开放状态更新（`ORDER_UPDATE`）和终态通知（`ORDER_TERMINAL`）。前提：先通过 Listen Key 接口获取 `listenKey`。
      tags:
        - user-streams
      operationId: orderReportStream
      externalDocs:
        url: https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/ws-streams/user-streams#order-report-stream
      x-connectors-examples:
        ts: https://raw.githubusercontent.com/binance/binance-connector-js/master/clients/stocks/examples/websocket-streams/UserStreamsApi/orderReportStream.ts
        rust: https://raw.githubusercontent.com/binance/binance-connector-rust/main/examples/stocks/websocket_streams/user_streams_api/order_report_stream.rs
        python: https://raw.githubusercontent.com/binance/binance-connector-python/master/clients/stocks/examples/websocket_streams/UserStreams/order_report_stream.py
        java: https://raw.githubusercontent.com/binance/binance-connector-java/master/examples/stocks/src/main/java/com/binance/connector/client/stocks/websocket/stream/websocketmarketstreams/userstreams/OrderReportStreamExample.java
        go: https://raw.githubusercontent.com/binance/binance-connector-go/main/clients/stocks/examples/websocketstreams//UserStreamsAPI/OrderReportStream/OrderReportStream.go
      parameters:
        - name: listenKey
          in: path
          required: true
          schema:
            type: string
            example: pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s6af0dkfj2a97b8a91d
          description: 从 Listen Key 接口获取的用户数据 listenKey。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                method:
                  type: string
                  description: WebSocket 数据流方法名称。
                  enum:
                    - SUBSCRIBE
                  example: SUBSCRIBE
                params:
                  type: array
                  items:
                    type: string
                  description: 要订阅的数据流列表。
                  example:
                    - ws/pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s6af0dkfj2a97b8a91d@orderReport
                id:
                  type: string
                  description: 唯一的 WebSocket 请求 ID。
                  example: '1'
              required:
                - method
                - params
                - id
              additionalProperties: false
            example:
              method: SUBSCRIBE
              params:
                - ws/pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s6af0dkfj2a97b8a91d@orderReport
              id: '1'
      responses:
        Raw Stream:
          description: 订单回报流
          content:
            application/json:
              schema:
                type: object
                properties:
                  e:
                    type: string
                    example: orderReport
                    description: 事件类型，固定为 `"orderReport"`。
                  E:
                    type: integer
                    format: int64
                    example: 1710000000000
                    description: 事件时间（epoch 毫秒）；服务端推送时间。
                  x:
                    type: string
                    example: ORDER_UPDATE
                    enum:
                      - ORDER_UPDATE
                      - ORDER_TERMINAL
                    description: 执行类型：`"ORDER_UPDATE"`（仍开放）或 `"ORDER_TERMINAL"`（已到达终态）。
                  i:
                    type: string
                    example: b0b6dd9d-8b9b-48a9-ba46-b9d54906e415
                    description: 订单 ID（UUID）。
                  ai:
                    type: string
                    example: 4ce9353c-66d1-46c2-898f-fce867ab0247
                    description: 资产 ID（内部标识）。
                  b:
                    type: string
                    example: EQ_AAPL
                    description: 基础资产——带 `EQ_` 前缀的内部资产代码（如 `"EQ_AAPL"`），而非 REST 响应/下单入参里用的裸 ticker。如需与别处的 symbol 匹配，请去掉 `EQ_` 前缀。
                  q:
                    type: string
                    example: USD
                    description: 计价货币，例如 `"USD"`。
                  S:
                    type: string
                    example: buy
                    description: 订单方向：`"buy"` 或 `"sell"`。注意：为小写，与 REST 响应不同。
                  o:
                    type: string
                    example: limit
                    description: 订单类型：`"market"` / `"limit"` / `"stop"` / `"stop_limit"` / `"trailing_stop"`。注意：为小写。
                  p:
                    type: number
                    nullable: true
                    example: 185.5
                    description: 限价；市价单为 null。
                  Q:
                    type: number
                    example: 10
                    description: 订单数量（股数）；按名义金额下单时为 `0`。
                  'N':
                    type: number
                    nullable: true
                    example: null
                    description: 订单名义金额；按名义金额下单（市价买入）时填充，按数量下单时为 null。
                  fq:
                    type: number
                    example: 5
                    description: 已成交数量。
                  FN:
                    type: number
                    example: 927.5
                    description: 已成交名义金额（= 成交数量 × 均价）。
                  tc:
                    type: number
                    example: 1856.2
                    description: 总成本（含手续费的累计买入成本）。
                  Z:
                    type: number
                    example: 50
                    description: 成交进度百分比（0–100，2 位小数）。按名义金额：`FN / N × 100`；按数量：`fq / Q × 100`。
                  'n':
                    type: string
                    example: Regular
                    description: 交易时段标签，例如 `"Regular"`、`"24 Hours Trading"`。
                  s:
                    type: string
                    example: partially_filled
                    description: 订单状态，例如 `"accepted"`、`"partially_filled"`、`"filled"`、`"canceled"`。注意：为小写，与 REST 响应不同。
                  T:
                    type: integer
                    format: int64
                    example: 1710000000000
                    description: 订单创建时间（epoch 毫秒）。
                  U:
                    type: integer
                    format: int64
                    example: 1710000060000
                    description: 订单更新时间（epoch 毫秒）。
              example:
                e: orderReport
                E: 1710000000000
                x: ORDER_UPDATE
                i: b0b6dd9d-8b9b-48a9-ba46-b9d54906e415
                ai: 4ce9353c-66d1-46c2-898f-fce867ab0247
                b: EQ_AAPL
                q: USD
                S: buy
                o: limit
                p: 185.5
                Q: 10
                'N': null
                fq: 5
                FN: 927.5
                tc: 1856.2
                Z: 50
                'n': Regular
                s: partially_filled
                T: 1710000000000
                U: 1710000060000
        Combined Stream:
          description: Stream payload with stream name.
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream:
                    type: string
                    example: ws/pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s6af0dkfj2a97b8a91d@orderReport
                  data:
                    type: object
                    properties:
                      e:
                        type: string
                        example: orderReport
                        description: 事件类型，固定为 `"orderReport"`。
                      E:
                        type: integer
                        format: int64
                        example: 1710000000000
                        description: 事件时间（epoch 毫秒）；服务端推送时间。
                      x:
                        type: string
                        example: ORDER_UPDATE
                        enum:
                          - ORDER_UPDATE
                          - ORDER_TERMINAL
                        description: 执行类型：`"ORDER_UPDATE"`（仍开放）或 `"ORDER_TERMINAL"`（已到达终态）。
                      i:
                        type: string
                        example: b0b6dd9d-8b9b-48a9-ba46-b9d54906e415
                        description: 订单 ID（UUID）。
                      ai:
                        type: string
                        example: 4ce9353c-66d1-46c2-898f-fce867ab0247
                        description: 资产 ID（内部标识）。
                      b:
                        type: string
                        example: EQ_AAPL
                        description: 基础资产——带 `EQ_` 前缀的内部资产代码（如 `"EQ_AAPL"`），而非 REST 响应/下单入参里用的裸 ticker。如需与别处的 symbol 匹配，请去掉 `EQ_` 前缀。
                      q:
                        type: string
                        example: USD
                        description: 计价货币，例如 `"USD"`。
                      S:
                        type: string
                        example: buy
                        description: 订单方向：`"buy"` 或 `"sell"`。注意：为小写，与 REST 响应不同。
                      o:
                        type: string
                        example: limit
                        description: 订单类型：`"market"` / `"limit"` / `"stop"` / `"stop_limit"` / `"trailing_stop"`。注意：为小写。
                      p:
                        type: number
                        nullable: true
                        example: 185.5
                        description: 限价；市价单为 null。
                      Q:
                        type: number
                        example: 10
                        description: 订单数量（股数）；按名义金额下单时为 `0`。
                      'N':
                        type: number
                        nullable: true
                        example: null
                        description: 订单名义金额；按名义金额下单（市价买入）时填充，按数量下单时为 null。
                      fq:
                        type: number
                        example: 5
                        description: 已成交数量。
                      FN:
                        type: number
                        example: 927.5
                        description: 已成交名义金额（= 成交数量 × 均价）。
                      tc:
                        type: number
                        example: 1856.2
                        description: 总成本（含手续费的累计买入成本）。
                      Z:
                        type: number
                        example: 50
                        description: 成交进度百分比（0–100，2 位小数）。按名义金额：`FN / N × 100`；按数量：`fq / Q × 100`。
                      'n':
                        type: string
                        example: Regular
                        description: 交易时段标签，例如 `"Regular"`、`"24 Hours Trading"`。
                      s:
                        type: string
                        example: partially_filled
                        description: 订单状态，例如 `"accepted"`、`"partially_filled"`、`"filled"`、`"canceled"`。注意：为小写，与 REST 响应不同。
                      T:
                        type: integer
                        format: int64
                        example: 1710000000000
                        description: 订单创建时间（epoch 毫秒）。
                      U:
                        type: integer
                        format: int64
                        example: 1710000060000
                        description: 订单更新时间（epoch 毫秒）。
                required:
                  - stream
                  - data
                additionalProperties: false
              example:
                stream: ws/pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s6af0dkfj2a97b8a91d@orderReport
                data:
                  e: orderReport
                  E: 1710000000000
                  x: ORDER_UPDATE
                  i: b0b6dd9d-8b9b-48a9-ba46-b9d54906e415
                  ai: 4ce9353c-66d1-46c2-898f-fce867ab0247
                  b: EQ_AAPL
                  q: USD
                  S: buy
                  o: limit
                  p: 185.5
                  Q: 10
                  'N': null
                  fq: 5
                  FN: 927.5
                  tc: 1856.2
                  Z: 50
                  'n': Regular
                  s: partially_filled
                  T: 1710000000000
                  U: 1710000060000
