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

# trade@BASE_QUOTE

> Subscribe to real-time trade notifications for a specific trading pair

This topic listens for trades of a given pair (BASE\_QUOTE), so it will be notified every time a trade happens.

## Subscription Request

<ParamField body="method" type="string" required>
  Subscribe method. Must be `subscribe`
</ParamField>

<ParamField body="topics" type="array" required>
  Array of topics to subscribe to. Format: `trade@BASE_QUOTE`

  Example: `["trade@ETH_BRL", "trade@BTC_BRL"]`
</ParamField>

## Stream Response

<ResponseField name="id" type="integer">
  Each WebSocket message includes a sequential numeric id. Each topic has its own unique sequence, and for private topics, the sequence is unique to each topic and user. It's important to note that some topics will send a "welcome message", which will have an id value of -1. Additionally, this sequence may be reset between connections, so be sure to update this value locally whenever you reconnect.
</ResponseField>

<ResponseField name="topic" type="string">
  Topic name (format: `trade@BASE_QUOTE`)
</ResponseField>

<ResponseField name="timestamp" type="integer">
  Timestamp in milliseconds
</ResponseField>

<ResponseField name="body" type="object">
  Trade details object

  <Expandable title="Trade Details">
    <ResponseField name="id" type="string">
      Trade identifier
    </ResponseField>

    <ResponseField name="amount" type="number">
      Amount traded in the base currency
    </ResponseField>

    <ResponseField name="date" type="string">
      Trade execution datetime (ISO 8601 format)
    </ResponseField>

    <ResponseField name="pair" type="string">
      Trading pair code (e.g., ETH\_BRL)
    </ResponseField>

    <ResponseField name="price" type="number">
      Price per unit at which trade was executed
    </ResponseField>

    <ResponseField name="total_value" type="number">
      Total value of the trade (amount × price)
    </ResponseField>

    <ResponseField name="timestamp" type="integer">
      Trade timestamp in milliseconds
    </ResponseField>

    <ResponseField name="maker_order_id" type="string">
      Order ID of the maker (liquidity provider)
    </ResponseField>

    <ResponseField name="maker_side" type="string">
      Maker order side: `buy` or `sell`
    </ResponseField>

    <ResponseField name="maker_type" type="string">
      Maker order type (e.g., `limit`, `market`)
    </ResponseField>

    <ResponseField name="taker_order_id" type="string">
      Order ID of the taker (liquidity taker)
    </ResponseField>

    <ResponseField name="taker_side" type="string">
      Taker order side: `buy` or `sell`
    </ResponseField>

    <ResponseField name="taker_type" type="string">
      Taker order type (e.g., `limit`, `market`)
    </ResponseField>
  </Expandable>
</ResponseField>

## Subscription Example

```json theme={null}
{
  "method": "subscribe",
  "topics": [
    "trade@ETH_BRL"
  ]
}
```

## Stream Response Example

```json theme={null}
{
  "id": 1,
  "topic": "trade@ETH_BRL",
  "timestamp": 1672856503549,
  "body": {
    "amount": 0.2404764,
    "date": "2019-01-03T02:27:33.947Z",
    "id": "2B222F22-5235-45FA-97FC-E9DBFA2575EE",
    "maker_order_id": "F49F5BD8-3F5B-4364-BCEE-F36F62DB966A",
    "maker_side": "buy",
    "maker_type": "limit",
    "pair": "ETH_BRL",
    "price": 15160,
    "taker_order_id": "FEAB5CEC-7F9E-4F95-B67D-9E8D5C739BE3",
    "taker_side": "sell",
    "taker_type": "market",
    "timestamp": 1675780847920,
    "total_value": 3638.4
  }
}
```

## Multiple Subscriptions Example

```json theme={null}
{
  "method": "subscribe",
  "topics": [
    "trade@ETH_BRL",
    "trade@BTC_BRL",
    "trade@BTC_USD"
  ]
}
```

## Usage Notes

* **Real-time Updates**: You will receive a notification every time a trade executes on the specified pair
* **Multiple Pairs**: You can subscribe to multiple trading pairs in a single request
* **Maker vs Taker**: The response includes information about both sides of the trade:
  * Maker: The order that was already in the order book
  * Taker: The incoming order that matched with the maker
* **Volume Information**: Use the `amount` and `price` fields to calculate trade volume and values

## Use Cases

* **Trade Feed**: Display a real-time feed of all trades for specific pairs
* **Market Activity**: Monitor market activity and trading volume
* **Order Matching**: Track when your orders have been executed and matched
* **Analytics**: Collect trade data for analysis and reporting
