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

# Public Trades Stream

> Real-time public trade executions for a contract.

This stream is available on the `optionsPublicTrades` subscription. It provides real-time public trade executions for a single **contract**.

#### Snapshot vs. Delta

The `emitPublicCompletedOrders` request returns a snapshot of recent trades via `publicCompletedOrders`. Use it to hydrate recent trades when you first subscribe, or to resynchronize after a gap.


## AsyncAPI

````yaml latest/options/asyncapi/options-ws.yaml publicTradesStream
id: publicTradesStream
title: Public Trades Stream
description: >
  Available on the `optionsPublicTrades` subscription. Real-time public trade
  executions for a single contract.
servers:
  - id: sandbox
    protocol: wss
    host: ws.sandbox.rails.xyz
    bindings: []
    variables: []
address: >-
  ?product=options&market={market}&expiration={expiration}&strike={strike}&type={type}&subscriptions=optionsPublicTrades
parameters:
  - id: market
    jsonSchema:
      type: string
      description: A specific market (e.g. `BTC-USDT`) or `ALL`.
      default: BTC-USDT
    description: A specific market (e.g. `BTC-USDT`) or `ALL`.
    type: string
    required: true
    deprecated: false
  - id: expiration
    jsonSchema:
      type: string
      description: >-
        Contract expiration, e.g. `24JUN26`. Requires `market`; omit to match
        every expiration.
      default: 24JUN26
    description: >-
      Contract expiration, e.g. `24JUN26`. Requires `market`; omit to match
      every expiration.
    type: string
    required: true
    deprecated: false
  - id: strike
    jsonSchema:
      type: string
      description: >-
        Strike price, e.g. `62000`. Requires `expiration`; omit to match every
        strike.
      default: '62000'
    description: >-
      Strike price, e.g. `62000`. Requires `expiration`; omit to match every
      strike.
    type: string
    required: true
    deprecated: false
  - id: type
    jsonSchema:
      type: string
      description: '`C` (call) or `P` (put). Requires `strike`; omit to match both.'
      default: C
    description: '`C` (call) or `P` (put). Requires `strike`; omit to match both.'
    type: string
    required: true
    deprecated: false
bindings: []
operations:
  - &ref_2
    id: emitPublicCompletedOrders
    title: Emit public completed orders
    description: Request a snapshot of recent public trades for a contract.
    type: receive
    messages:
      - &ref_5
        id: emitPublicCompletedOrdersRequest
        contentType: application/json
        payload:
          - name: Emit Public Completed Orders
            type: object
            properties:
              - name: message
                type: string
                description: Always `emitPublicCompletedOrders`.
                required: true
              - name: content
                type: object
                required: true
                properties:
                  - name: clientRequestId
                    type: string
                    description: Client-generated UUID for correlation
                    required: false
                  - name: market
                    type: string
                    description: Contract name
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            message:
              type: string
              description: Always `emitPublicCompletedOrders`.
              x-parser-schema-id: <anonymous-schema-331>
            content:
              type: object
              properties:
                clientRequestId:
                  type: string
                  format: uuid
                  description: Client-generated UUID for correlation
                  x-parser-schema-id: <anonymous-schema-333>
                market:
                  type: string
                  description: Contract name
                  x-parser-schema-id: <anonymous-schema-334>
              required:
                - market
              x-parser-schema-id: <anonymous-schema-332>
          required:
            - message
            - content
          x-parser-schema-id: <anonymous-schema-330>
        title: Emit Public Completed Orders
        example: |-
          {
            "message": "emitPublicCompletedOrders",
            "content": {
              "clientRequestId": "f45cf3c8-3f2d-4ace-80de-8cb4da0a63bb",
              "market": "BTC-10JUL26-55000-C"
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: emitPublicCompletedOrdersRequest
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: publicTradesStream
  - &ref_3
    id: publicTradesSnapshot
    title: Public trades snapshot
    description: Response to `emitPublicCompletedOrders`.
    type: send
    messages:
      - &ref_6
        id: publicCompletedOrdersResponse
        contentType: application/json
        payload:
          - name: Public Trades Snapshot
            description: Response to `emitPublicCompletedOrders`.
            type: object
            properties:
              - name: resultType
                type: string
                description: Always `publicCompletedOrders`.
                required: true
              - name: market
                type: string
                description: Contract name
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: clientRequestId
                    type: string
                    description: Client-generated UUID for correlation
                    required: false
                  - name: trades
                    type: array
                    description: Snapshot of recent trade executions
                    required: true
                    properties:
                      - name: executionType
                        type: string
                        description: Execution role
                        enumValues:
                          - taker
                          - maker
                        required: true
                      - name: matchId
                        type: string
                        description: >-
                          Identifier for the trade match, shared by the taker
                          and maker entries
                        required: true
                      - name: price
                        type: string
                        description: Execution price
                        required: true
                      - name: quantity
                        type: string
                        description: Execution quantity
                        required: true
                      - name: side
                        type: string
                        description: Order side
                        enumValues:
                          - buy
                          - sell
                        required: true
                      - name: updatedAt
                        type: integer
                        description: Execution timestamp (ms since epoch)
                        required: true
                  - name: statusCode
                    type: integer
                    description: Always `200`.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            resultType:
              type: string
              description: Always `publicCompletedOrders`.
              x-parser-schema-id: <anonymous-schema-336>
            market:
              type: string
              description: Contract name
              x-parser-schema-id: <anonymous-schema-337>
            data:
              type: object
              properties:
                clientRequestId:
                  type: string
                  description: Client-generated UUID for correlation
                  x-parser-schema-id: <anonymous-schema-339>
                trades:
                  type: array
                  description: Snapshot of recent trade executions
                  items: &ref_1
                    type: object
                    properties:
                      executionType:
                        type: string
                        enum:
                          - taker
                          - maker
                        description: Execution role
                        x-parser-schema-id: <anonymous-schema-341>
                      matchId:
                        type: string
                        description: >-
                          Identifier for the trade match, shared by the taker
                          and maker entries
                        x-parser-schema-id: <anonymous-schema-342>
                      price:
                        type: string
                        description: Execution price
                        x-parser-schema-id: <anonymous-schema-343>
                      quantity:
                        type: string
                        description: Execution quantity
                        x-parser-schema-id: <anonymous-schema-344>
                      side:
                        type: string
                        enum:
                          - buy
                          - sell
                        description: Order side
                        x-parser-schema-id: <anonymous-schema-345>
                      updatedAt:
                        type: integer
                        description: Execution timestamp (ms since epoch)
                        x-parser-schema-id: <anonymous-schema-346>
                    required:
                      - executionType
                      - matchId
                      - price
                      - quantity
                      - side
                      - updatedAt
                    x-parser-schema-id: TradeExecution
                  x-parser-schema-id: <anonymous-schema-340>
                statusCode:
                  type: integer
                  description: Always `200`.
                  x-parser-schema-id: <anonymous-schema-347>
              required:
                - trades
                - statusCode
              x-parser-schema-id: <anonymous-schema-338>
          required:
            - resultType
            - market
            - data
          x-parser-schema-id: <anonymous-schema-335>
        title: Public Trades Snapshot
        description: Response to `emitPublicCompletedOrders`.
        example: |-
          {
            "resultType": "publicCompletedOrders",
            "market": "BTC-10JUL26-55000-C",
            "data": {
              "clientRequestId": "f45cf3c8-3f2d-4ace-80de-8cb4da0a63bb",
              "trades": [
                {
                  "executionType": "taker",
                  "matchId": "9b8e7bc6-c111-46e7-81f2-04691780c1fd-1",
                  "price": "7204.26",
                  "quantity": "1",
                  "side": "sell",
                  "updatedAt": 1783352484840
                },
                {
                  "executionType": "maker",
                  "matchId": "9b8e7bc6-c111-46e7-81f2-04691780c1fd-1",
                  "price": "7204.26",
                  "quantity": "1",
                  "side": "buy",
                  "updatedAt": 1783086811956
                },
                {
                  "executionType": "taker",
                  "matchId": "a9716fab-8ac2-47fd-803e-44e2ca22b948-1",
                  "price": "7210.97",
                  "quantity": "1",
                  "side": "buy",
                  "updatedAt": 1783339818825
                },
                {
                  "executionType": "maker",
                  "matchId": "a9716fab-8ac2-47fd-803e-44e2ca22b948-1",
                  "price": "7210.97",
                  "quantity": "1",
                  "side": "sell",
                  "updatedAt": 1783086557575
                }
              ],
              "statusCode": 200
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: publicCompletedOrdersResponse
    bindings: []
    extensions: *ref_0
  - &ref_4
    id: publicTradesUpdate
    title: Public trades update
    description: Pushed whenever new trades are executed on the contract.
    type: send
    messages:
      - &ref_7
        id: publicCompletedOrdersDelta
        contentType: application/json
        payload:
          - name: Public Trades Delta
            type: object
            properties:
              - name: resultType
                type: string
                description: Always `publicCompletedOrdersDelta`.
                required: true
              - name: market
                type: string
                description: Contract name
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: trades
                    type: array
                    description: New trade executions since the last update
                    required: true
                    properties:
                      - name: executionType
                        type: string
                        description: Execution role
                        enumValues:
                          - taker
                          - maker
                        required: true
                      - name: matchId
                        type: string
                        description: >-
                          Identifier for the trade match, shared by the taker
                          and maker entries
                        required: true
                      - name: price
                        type: string
                        description: Execution price
                        required: true
                      - name: quantity
                        type: string
                        description: Execution quantity
                        required: true
                      - name: side
                        type: string
                        description: Order side
                        enumValues:
                          - buy
                          - sell
                        required: true
                      - name: updatedAt
                        type: integer
                        description: Execution timestamp (ms since epoch)
                        required: true
                  - name: statusCode
                    type: integer
                    description: Always `200`.
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            resultType:
              type: string
              description: Always `publicCompletedOrdersDelta`.
              x-parser-schema-id: <anonymous-schema-349>
            market:
              type: string
              description: Contract name
              x-parser-schema-id: <anonymous-schema-350>
            data:
              type: object
              properties:
                trades:
                  type: array
                  description: New trade executions since the last update
                  items: *ref_1
                  x-parser-schema-id: <anonymous-schema-352>
                statusCode:
                  type: integer
                  description: Always `200`.
                  x-parser-schema-id: <anonymous-schema-353>
              required:
                - trades
                - statusCode
              x-parser-schema-id: <anonymous-schema-351>
          required:
            - resultType
            - market
            - data
          x-parser-schema-id: <anonymous-schema-348>
        title: Public Trades Delta
        example: |-
          {
            "resultType": "publicCompletedOrdersDelta",
            "market": "BTC-10JUL26-55000-C",
            "data": {
              "trades": [
                {
                  "executionType": "taker",
                  "matchId": "01KWM432SK16GA5ZV3H6TQSDRC:01KWW1ERZ59PWXTRVP2YSDA2SB",
                  "price": "7204.26",
                  "quantity": "1",
                  "side": "sell",
                  "updatedAt": 1783352484913
                }
              ],
              "statusCode": 200
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: publicCompletedOrdersDelta
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
  - *ref_4
sendMessages:
  - *ref_5
receiveMessages:
  - *ref_6
  - *ref_7
extensions:
  - id: x-parser-unique-object-id
    value: publicTradesStream
securitySchemes:
  - id: wsAuth
    name: Sec-WebSocket-Protocol
    type: httpApiKey
    description: Supply as `authorization#<JWT>` during the WebSocket handshake.
    in: header
    extensions: []

````