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

# Account Trades Stream

> Real-time trade updates for your account, across all markets.

This stream is available on the `trades` subscription. It provides real-time trade updates for your account across all markets, regardless of which market you subscribed to. You will receive a `completedOrdersDelta` message as a batch whenever new trades are executed.

There is no snapshot request for this stream — for historical fills, use the [Get Completed Orders](/latest/perps/rest-api/get-account-completed-orders) REST endpoint.


## AsyncAPI

````yaml latest/perps/asyncapi/perps-ws.yaml accountTradesStream
id: accountTradesStream
title: Account Trades Stream
description: >
  Available on the `trades` subscription. Real-time fills for your account
  across all markets, regardless of which market you connected with.
servers:
  - id: sandbox
    protocol: wss
    host: ws.sandbox.rails.xyz
    bindings: []
    variables: []
address: '?product=perpetuals&market={market}&subscriptions=trades'
parameters:
  - id: market
    jsonSchema:
      type: string
      description: >
        A specific market (e.g. `BTC-USDT`) or `ALL`. When `ALL` is used,
        `market` must be supplied explicitly in the `content` of every request
        that accepts it.
      default: BTC-USDT
    description: >
      A specific market (e.g. `BTC-USDT`) or `ALL`. When `ALL` is used, `market`
      must be supplied explicitly in the `content` of every request that accepts
      it.
    type: string
    required: true
    deprecated: false
bindings: []
operations:
  - &ref_0
    id: accountTradesUpdate
    title: Account trades update
    description: Pushed whenever new trades are executed on your account.
    type: send
    messages:
      - &ref_1
        id: completedOrdersDelta
        contentType: application/json
        payload:
          - name: Account Trades Delta
            description: >-
              Pushed whenever new trades are executed on your account, across
              all markets.
            type: object
            properties:
              - name: resultType
                type: string
                description: Always `completedOrdersDelta`.
                required: true
              - name: data
                type: array
                description: Batch of completed order entries
                required: true
                properties:
                  - name: market
                    type: string
                    description: Market name
                    required: true
                  - name: orderId
                    type: string
                    description: Unique identifier of the order
                    required: true
                  - name: matchId
                    type: string
                    description: Unique identifier for the trade match
                    required: true
                  - name: orderType
                    type: string
                    description: Order side
                    enumValues:
                      - buy
                      - sell
                    required: true
                  - name: tradeType
                    type: string
                    description: Order type
                    enumValues:
                      - limit
                      - market
                    required: true
                  - name: executionType
                    type: string
                    description: Execution role
                    enumValues:
                      - taker
                      - maker
                    required: true
                  - name: fillType
                    type: string
                    description: >-
                      Whether this execution completely or partially filled the
                      order
                    enumValues:
                      - partial
                      - complete
                    required: true
                  - name: price
                    type: string
                    description: Execution price
                    required: true
                  - name: quantity
                    type: string
                    description: Execution quantity
                    required: true
                  - name: leverage
                    type: string
                    description: Leverage at time of execution
                    required: true
                  - name: fees
                    type: string
                    description: Fees charged for the trade
                    required: true
                  - name: orderCreatedAt
                    type: integer
                    description: Order creation timestamp (milliseconds since epoch)
                    required: true
                  - name: orderFilledAt
                    type: integer
                    description: Order fill timestamp (milliseconds since epoch)
                    required: true
                  - name: triggerType
                    type: string
                    description: What triggered order creation, if anything
                    enumValues:
                      - none
                      - take_profit
                      - stop_loss
                      - liquidation
                    required: true
                  - name: triggerPrice
                    type: string
                    description: >-
                      Price that triggered order creation; present when
                      `triggerType` is not `none`
                    required: true
                  - name: triggerCreatedAt
                    type: integer
                    description: Trigger creation timestamp (milliseconds since epoch)
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          properties:
            resultType:
              type: string
              description: Always `completedOrdersDelta`.
              x-parser-schema-id: <anonymous-schema-213>
            data:
              type: array
              description: Batch of completed order entries
              items:
                type: object
                properties:
                  market:
                    type: string
                    description: Market name
                    x-parser-schema-id: <anonymous-schema-215>
                  orderId:
                    type: string
                    description: Unique identifier of the order
                    x-parser-schema-id: <anonymous-schema-216>
                  matchId:
                    type: string
                    description: Unique identifier for the trade match
                    x-parser-schema-id: <anonymous-schema-217>
                  orderType:
                    type: string
                    enum:
                      - buy
                      - sell
                    description: Order side
                    x-parser-schema-id: <anonymous-schema-218>
                  tradeType:
                    type: string
                    enum:
                      - limit
                      - market
                    description: Order type
                    x-parser-schema-id: <anonymous-schema-219>
                  executionType:
                    type: string
                    enum:
                      - taker
                      - maker
                    description: Execution role
                    x-parser-schema-id: <anonymous-schema-220>
                  fillType:
                    type: string
                    enum:
                      - partial
                      - complete
                    description: >-
                      Whether this execution completely or partially filled the
                      order
                    x-parser-schema-id: <anonymous-schema-221>
                  price:
                    type: string
                    description: Execution price
                    x-parser-schema-id: <anonymous-schema-222>
                  quantity:
                    type: string
                    description: Execution quantity
                    x-parser-schema-id: <anonymous-schema-223>
                  leverage:
                    type: string
                    description: Leverage at time of execution
                    x-parser-schema-id: <anonymous-schema-224>
                  fees:
                    type: string
                    description: Fees charged for the trade
                    x-parser-schema-id: <anonymous-schema-225>
                  orderCreatedAt:
                    type: integer
                    description: Order creation timestamp (milliseconds since epoch)
                    x-parser-schema-id: <anonymous-schema-226>
                  orderFilledAt:
                    type: integer
                    description: Order fill timestamp (milliseconds since epoch)
                    x-parser-schema-id: <anonymous-schema-227>
                  triggerType:
                    type: string
                    enum:
                      - none
                      - take_profit
                      - stop_loss
                      - liquidation
                    description: What triggered order creation, if anything
                    x-parser-schema-id: <anonymous-schema-228>
                  triggerPrice:
                    type: string
                    description: >-
                      Price that triggered order creation; present when
                      `triggerType` is not `none`
                    x-parser-schema-id: <anonymous-schema-229>
                  triggerCreatedAt:
                    type: integer
                    description: Trigger creation timestamp (milliseconds since epoch)
                    x-parser-schema-id: <anonymous-schema-230>
                required:
                  - market
                  - orderId
                  - matchId
                  - orderType
                  - tradeType
                  - executionType
                  - fillType
                  - price
                  - quantity
                  - leverage
                  - fees
                  - orderCreatedAt
                  - orderFilledAt
                  - triggerType
                  - triggerPrice
                  - triggerCreatedAt
                x-parser-schema-id: AccountTradeFill
              x-parser-schema-id: <anonymous-schema-214>
          required:
            - resultType
            - data
          x-parser-schema-id: <anonymous-schema-212>
        title: Account Trades Delta
        description: >-
          Pushed whenever new trades are executed on your account, across all
          markets.
        example: |-
          {
            "resultType": "completedOrdersDelta",
            "data": [
              {
                "market": "BTC-USDT",
                "orderId": "01JSG88WSP6MWEXBNXT0F43S59",
                "matchId": "65284509-5284-4f64-9b80-ed6aa9819b9b",
                "orderType": "buy",
                "tradeType": "market",
                "executionType": "taker",
                "fillType": "partial",
                "price": "92911.48605",
                "quantity": "23.4",
                "leverage": "1",
                "fees": "2174.12877357",
                "orderCreatedAt": 1745436937022,
                "orderFilledAt": 1745376015255,
                "triggerType": "none",
                "triggerPrice": "0",
                "triggerCreatedAt": 0
              },
              {
                "market": "ETH-USDT",
                "orderId": "01JSG88WSP6MWEXBNXT0F43S60",
                "matchId": "95284509-5284-4f64-9b80-ed6aa9819b9a",
                "orderType": "sell",
                "tradeType": "limit",
                "executionType": "maker",
                "fillType": "complete",
                "price": "3598.04",
                "quantity": "6.6",
                "leverage": "1",
                "fees": "9.49",
                "orderCreatedAt": 1745436937023,
                "orderFilledAt": 1745376015256,
                "triggerType": "none",
                "triggerPrice": "0",
                "triggerCreatedAt": 0
              }
            ]
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: completedOrdersDelta
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: accountTradesStream
sendOperations: []
receiveOperations:
  - *ref_0
sendMessages: []
receiveMessages:
  - *ref_1
extensions:
  - id: x-parser-unique-object-id
    value: accountTradesStream
securitySchemes:
  - id: wsAuth
    name: Sec-WebSocket-Protocol
    type: httpApiKey
    description: |
      Supply as `authorization#<JWT>` during the WebSocket handshake.
    in: header
    extensions: []

````