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

# TX Counts

> Stream per-trader and per-token buy/sell counts.

> [!NOTE]
>
> **Room ID:** `tx_counts` \
> **Endpoint:** `wss://staging-api.struct.to/ws`

Live buy/sell transaction counts at two levels, for every timeframe (`1d`, `3d`, `7d`, `14d`, `30d`, `lifetime`): per (trader, token) when `token_address` is present, and per-trader aggregate when it is omitted.

## Subscribe

Match any of `traders` or `tokens`, capped at 500 combined. A trader subscription includes both per-token and aggregate counts.

### Filters

| Filter | Type | Required | Description |
| - | - | - | - |
| `chain` | `string` | No\* | Chain name: `solana`, `bnb`, `base`, `ethereum`, `robinhood`, `arc` |
| `chain_id` | `integer` | No\* | Chain id: `-1`, `56`, `8453`, `1`, `4663`, `5042` |
| `traders` | `string[]` | No | Trader wallet addresses |
| `tokens` | `string[]` | No | Token addresses |
| `timeframes` | `string[]` | No | `1d`, `3d`, `7d`, `14d`, `30d`, `lifetime`. Empty = all |
| `subscribe_all` | `boolean` | No | Receive every update. Defaults to true when no traders or tokens are set |

Provide either `chain` or `chain_id`. Do not send both.

### Example

```json theme={null}
{
  "type": "join_room",
  "payload": {
    "room_id": "tx_counts"
  }
}
```

```json theme={null}
{
  "type": "room_message",
  "payload": {
    "room_id": "tx_counts",
    "message": {
      "action": "subscribe",
      "chain": "solana",
      "traders": [
        "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
      ],
      "timeframes": [
        "1d",
        "lifetime"
      ]
    }
  }
}
```

## Events

The room emits `tx_counts_update`. Pick **Response (Long)** or **Response (Short)** in the right-hand panel. WebSocket defaults to short. See [long and short field names](https://docs.struct.to/api-reference/response-format.md#long-and-short-field-names).

```json Response (Long) theme={null}
{
  "type": "tx_counts_update",
  "room_id": "tx_counts",
  "data": {
    "chain_id": -1,
    "trader": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
    "token_address": "TokenMint111111111111111111111111111111111",
    "timeframe": "1d",
    "buy_count": 14,
    "sell_count": 6,
    "first_tx_hash": "5xFirstTx11111111111111111111111111111111111",
    "timestamp": 1710000000000
  }
}
```

```jsonc Response (Short) theme={null}
{
  "type": "tx_counts_update",
  "room_id": "tx_counts",
  "data": {
    "ci": -1,
    "tr": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
    "ta": "TokenMint111111111111111111111111111111111",
    "tf": "1d",
    "bc": 14,
    "sc": 6,
    "fth": "5xFirstTx11111111111111111111111111111111111",
    "t": 1710000000000
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.