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

# Trade

> Authenticated channel for streaming real-time trade fill updates.

<Note>Authenticated channel. Connect to: `wss://wss.prime.kraken.com/ws/v1`</Note>

Request stream of Trade messages. Upon subscription, the server will return all Trade for this client as long as the optional constraints are satisfied. Server will also send a Trade update when the order receives more fills or new fills arrive on a new order.

## Subscribe Request

<Tabs>
  <Tab title="Subscribe Schema">
    <ParamField path="reqid" type="number" required>
      Request ID - will be echoed back in the response structure.
    </ParamField>

    <ParamField path="type" type="string" required>
      Request type. Value: `subscribe`
    </ParamField>

    <ParamField path="streams" type="array" required>
      Array containing the Trade stream configuration.

      <Expandable title="properties">
        <ParamField path="name" type="string" required>
          Subscription name. Value: `Trade`
        </ParamField>

        <ParamField path="StartDate" type="string">
          If provided, the subscription will return trades that were executed after this time. An ISO-8601 UTC string of the form 2019-02-13T05:17:32.000000Z.
        </ParamField>

        <ParamField path="EndDate" type="string">
          If provided, the subscription will return trades that were executed before this time.
        </ParamField>

        <ParamField path="Symbol" type="string">
          If provided, Symbol of the security to get the orders for.
        </ParamField>

        <ParamField path="OrderID" type="string">
          If provided, filter by OrderID.
        </ParamField>

        <ParamField path="RFQID" type="string">
          If provided, filter by RFQID.
        </ParamField>
      </Expandable>
    </ParamField>
  </Tab>

  <Tab title="Example">
    ```json theme={null}
    {
      "reqid": 8,
      "type": "subscribe",
      "streams": [
        {
          "name": "Trade",
          "StartDate": "2021-09-14T00:00:00.000000Z"
        }
      ]
    }
    ```
  </Tab>
</Tabs>

## Response

<Tabs>
  <Tab title="Response Schema">
    <ParamField path="reqid" type="number" required>
      A number that relates this response to a request.
    </ParamField>

    <ParamField path="type" type="string" required>
      The type of message sent.
    </ParamField>

    <ParamField path="ts" type="string" required>
      An ISO-8601 UTC string of the form `2019-02-13T05:17:32.000000Z`.
    </ParamField>

    <ParamField path="initial" type="boolean">
      If this is initial data for a request, the initial flag will be set.
    </ParamField>

    <ParamField path="seqNum" type="number" required>
      The sequence number for this response per request.
    </ParamField>

    <ParamField path="action" type="string">
      "Update" or "Remove" - tells the client if the given entity should be removed or added/updated.
    </ParamField>

    <ParamField path="data" type="array" required>
      Array of Trade data.

      <Expandable title="properties">
        <ParamField path="Timestamp" type="string" required>
          Timestamp of the message.
        </ParamField>

        <ParamField path="Symbol" type="string" required>
          Security symbol for this trade (e.g. `BTC-USD`).
        </ParamField>

        <ParamField path="OrderID" type="string" required>
          Server assigned Order ID, will be a UUID.
        </ParamField>

        <ParamField path="TradeID" type="string" required>
          Server assigned Trade ID, will be a UUID.
        </ParamField>

        <ParamField path="Side" type="string" required>
          Trade side. Possible values: `Buy`, `Sell`
        </ParamField>

        <ParamField path="TransactTime" type="string" required>
          Transaction time.
        </ParamField>

        <ParamField path="ExecType" type="string" required>
          Describes the specific execution (e.g. Pending Cancel) while OrdStatus will always identify the current order status (e.g. Partially Filled).
        </ParamField>

        <ParamField path="Currency" type="string" required>
          Currency of Quantity.
        </ParamField>

        <ParamField path="Price" type="string">
          Order limit price, required when OrdType=Limit.
        </ParamField>

        <ParamField path="Quantity" type="string" required>
          Trade quantity.
        </ParamField>

        <ParamField path="Amount" type="string" required>
          Trade amount.
        </ParamField>

        <ParamField path="Fee" type="string">
          Trade fee.
        </ParamField>

        <ParamField path="FeeCurrency" type="string">
          Fee currency.
        </ParamField>

        <ParamField path="TradeStatus" type="string" required>
          Status of the trade. Possible values: `Pending`, `Confirmed`, `Canceled`
        </ParamField>

        <ParamField path="AggressorSide" type="string" required>
          Side of the aggressing order. Possible values: `Buy`, `Sell`
        </ParamField>

        <ParamField path="QuoteID" type="string">
          Server assigned QuoteID for RFQ Orders.
        </ParamField>

        <ParamField path="AmountCurrency" type="string" required>
          Currency of Amount.
        </ParamField>

        <ParamField path="DealtCurrency" type="string" required>
          Currency in which the trade was dealt.
        </ParamField>

        <ParamField path="MarketAccount" type="string">
          Market account associated with this trade.
        </ParamField>

        <ParamField path="Revision" type="number">
          Revision number for this trade update.
        </ParamField>

        <ParamField path="TradeSource" type="string">
          Source of the trade (e.g. `Dealer`).
        </ParamField>

        <ParamField path="TradeAction" type="string">
          Action for this trade update (e.g. `New`).
        </ParamField>

        <ParamField path="RFQID" type="string">
          Server assigned RFQID for RFQ Orders.
        </ParamField>

        <ParamField path="CustomerUser" type="string">
          The customer user associated with this trade.
        </ParamField>
      </Expandable>
    </ParamField>
  </Tab>

  <Tab title="Example">
    ```json theme={null}
    {
      "reqid": 8,
      "type": "Trade",
      "ts": "2021-09-14T22:29:32.255949Z",
      "initial": true,
      "seqNum": 1,
      "data": [
        {
          "Timestamp": "2021-09-14T22:23:11.989845Z",
          "Symbol": "BTC-USD",
          "OrderID": "1b6b882b-e2fc-4774-ad2d-9db4df536f29",
          "TradeID": "a0ec46f2-6d0e-451a-a4f1-2a0be7d32d26",
          "Side": "Buy",
          "TransactTime": "2021-09-14T22:23:11.964531Z",
          "ExecType": "Trade",
          "Currency": "BTC",
          "Price": "47085.090668824440",
          "Quantity": "0.20000000",
          "Amount": "9417.02",
          "Fee": "0",
          "CustomerUser": "tom@company.com",
          "TradeStatus": "Confirmed",
          "AggressorSide": "Buy",
          "AmountCurrency": "USD",
          "DealtCurrency": "BTC"
        }
      ]
    }
    ```
  </Tab>
</Tabs>
