> For the complete documentation index, see [llms.txt](https://noodles-finance.gitbook.io/docs.noodles.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://noodles-finance.gitbook.io/docs.noodles.fi/websocket/room-coin-updates.md).

# Room Coin UPDATE

## Overview

The COIN\_UPDATES room provides real-time updates for coins statistic. This room supports subscribing to multiple coins at once.

## Endpoint

```json
wss://ws.noodles.fi/ws/coin-update
```

## Subscription

**See:** [WebSocket Setup](/docs.noodles.fi/websocket/websocket-setup.md) for general WebSocket connection and management details.

### Client Subscription Message

```json
{
  "type": "subscribe",
  "room": "COIN_UPDATES",
  "data": {
    "coins": [
      "0x2::sui::SUI",
      "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
      "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP"
    ]
  }
}
```

## Server Response Data Format

```json
{
  "type": "data",
  "channel": "COIN_UPDATES-0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
  "room": "COIN_UPDATES",
  "data": {
    "coin": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
    "price": 3.45,
    "price_change_30m": 0.5,
    "price_change_1h": 1.2,
    "price_change_4h": 2.8,
    "price_change_6h": 3.1,
    "price_change_24h": 5.4,
    "vol_change_1d": 15.2,
    "liq_change_1d": 2.3,
    "tx_change_1d": 8.7,
    "tx_24h": 12500,
    "buy_vol_24h": 5000000.00,
    "sell_vol_24h": 3500000.00,
    "buy_tx_24h": 6000,
    "sell_tx_24h": 6500,
    "buy_vol_6h": 1200000.00,
    "sell_vol_6h": 800000.00,
    "buy_tx_6h": 1500,
    "sell_tx_6h": 1600,
    "buy_vol_4h": 900000.00,
    "sell_vol_4h": 700000.00,
    "buy_tx_4h": 1200,
    "sell_tx_4h": 1300,
    "buy_vol_1h": 300000.00,
    "sell_vol_1h": 200000.00,
    "buy_tx_1h": 400,
    "sell_tx_1h": 450,
    "buy_vol_30m": 150000.00,
    "sell_vol_30m": 100000.00,
    "buy_tx_30m": 200,
    "sell_tx_30m": 220,
    "volume_30m": 125000.50,
    "volume_1h": 275000.75,
    "volume_4h": 1250000.00,
    "volume_6h": 2100000.00,
    "volume_24h": 8500000.00,
    "maker_24h": 450,
    "market_cap": 12500000000.00,
    "liquidity_usd": 45000000.00,
    "rank": 15,
    "holders": 125000
  }
}
```

## Data Fields

| Field              | Type   | Description                                                   |
| ------------------ | ------ | ------------------------------------------------------------- |
| `coin`             | object | Coin basic information (coin\_ident, symbol, name)            |
| `price`            | number | Current price in USD (optional)                               |
| `price_change_30m` | number | Price change percentage over 30 minutes (optional)            |
| `price_change_1h`  | number | Price change percentage over 1 hour (optional)                |
| `price_change_4h`  | number | Price change percentage over 4 hours (optional)               |
| `price_change_6h`  | number | Price change percentage over 6 hours (optional)               |
| `price_change_24h` | number | Price change percentage over 24 hours (optional)              |
| `vol_change_1d`    | number | Volume change percentage over 1 day (optional)                |
| `liq_change_1d`    | number | Liquidity change percentage over 1 day (optional)             |
| `tx_change_1d`     | number | Transaction count change percentage over 1 day (optional)     |
| `tx_24h`           | number | Number of transactions in the last 24 hours (optional)        |
| `buy_vol_24h`      | number | Buy volume over 24 hours in USD (optional)                    |
| `sell_vol_24h`     | number | Sell volume over 24 hours in USD (optional)                   |
| `buy_tx_24h`       | number | Number of buy transactions in the last 24 hours (optional)    |
| `sell_tx_24h`      | number | Number of sell transactions in the last 24 hours (optional)   |
| `buy_vol_6h`       | number | Buy volume over 6 hours in USD (optional)                     |
| `sell_vol_6h`      | number | Sell volume over 6 hours in USD (optional)                    |
| `buy_tx_6h`        | number | Number of buy transactions in the last 6 hours (optional)     |
| `sell_tx_6h`       | number | Number of sell transactions in the last 6 hours (optional)    |
| `buy_vol_4h`       | number | Buy volume over 4 hours in USD (optional)                     |
| `sell_vol_4h`      | number | Sell volume over 4 hours in USD (optional)                    |
| `buy_tx_4h`        | number | Number of buy transactions in the last 4 hours (optional)     |
| `sell_tx_4h`       | number | Number of sell transactions in the last 4 hours (optional)    |
| `buy_vol_1h`       | number | Buy volume over 1 hour in USD (optional)                      |
| `sell_vol_1h`      | number | Sell volume over 1 hour in USD (optional)                     |
| `buy_tx_1h`        | number | Number of buy transactions in the last 1 hour (optional)      |
| `sell_tx_1h`       | number | Number of sell transactions in the last 1 hour (optional)     |
| `buy_vol_30m`      | number | Buy volume over 30 minutes in USD (optional)                  |
| `sell_vol_30m`     | number | Sell volume over 30 minutes in USD (optional)                 |
| `buy_tx_30m`       | number | Number of buy transactions in the last 30 minutes (optional)  |
| `sell_tx_30m`      | number | Number of sell transactions in the last 30 minutes (optional) |
| `volume_30m`       | number | Trading volume over 30 minutes in USD (optional)              |
| `volume_1h`        | number | Trading volume over 1 hour in USD (optional)                  |
| `volume_4h`        | number | Trading volume over 4 hours in USD (optional)                 |
| `volume_6h`        | number | Trading volume over 6 hours in USD (optional)                 |
| `volume_24h`       | number | Trading volume over 24 hours in USD (optional)                |
| `maker_24h`        | number | Number of unique makers in the last 24 hours (optional)       |
| `market_cap`       | number | Market capitalization in USD (optional)                       |
| `liquidity_usd`    | number | Total liquidity in USD (optional)                             |
| `rank`             | number | Coin ranking (optional)                                       |
| `holders`          | number | Number of token holders (optional)                            |

**Note**: All fields except `coin` are optional and may not be present in every update. Updates contain only the fields that have changed.

## Example Usage

### JavaScript

```javascript
const ws = new WebSocket('wss://ws.noodles.fi/ws/coin-update');

ws.onopen = function() {
    // Subscribe to multiple coin price updates
    ws.send(JSON.stringify({
        type: 'subscribe',
        room: 'COIN_UPDATES',
        data: {
            coins: [
                '0x2::sui::SUI',
                '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC'
            ]
        }
    }));
};

ws.onmessage = function(event) {
    const message = JSON.parse(event.data);
    
    if (message.type === 'data' && message.room === 'COIN_UPDATES') {
        const data = message.data;
        console.log(`${data.coin.symbol} (${data.coin.coin_ident})`);
        if (data.price) console.log(`Price: $${data.price}`);
        if (data.price_change_24h) console.log(`24h Change: ${data.price_change_24h}%`);
        if (data.volume_24h) console.log(`24h Volume: $${data.volume_24h}`);
        if (data.market_cap) console.log(`Market Cap: $${data.market_cap}`);
    }
};
```

### TypeScript

```typescript
interface BaseCoin {
  coin_ident: string;
  symbol: string;
  name: string;
}

interface CoinUpdateData {
  coin: BaseCoin;
  price?: number;
  price_change_30m?: number;
  price_change_1h?: number;
  price_change_4h?: number;
  price_change_6h?: number;
  price_change_24h?: number;
  vol_change_1d?: number;
  liq_change_1d?: number;
  tx_change_1d?: number;
  tx_24h?: number;
  volume_30m?: number;
  volume_1h?: number;
  volume_4h?: number;
  volume_6h?: number;
  volume_24h?: number;
  maker_24h?: number;
  market_cap?: number;
  liquidity_usd?: number;
  rank?: number;
  holders?: number;
}

// Track coin data in a map
const coinData = new Map<string, CoinUpdateData>();

client.onCoinUpdate = (channel: string, data: CoinUpdateData) => {
  coinData.set(data.coin.coin_ident, data);
  
  console.log('Coin Update:', {
    coin: data.coin.symbol,
    price: data.price ? `$${data.price}` : 'N/A',
    priceChange24h: data.price_change_24h ? `${data.price_change_24h}%` : 'N/A',
    volume24h: data.volume_24h ? `$${data.volume_24h.toLocaleString()}` : 'N/A',
    marketCap: data.market_cap ? `$${data.market_cap.toLocaleString()}` : 'N/A'
  });
  
  // Update UI or trigger alerts
  updateCoinDisplay(data.coin.coin_ident, data);
};

// Subscribe to multiple coins at once
client.subscribe('COIN_UPDATES', [
  '0x2::sui::SUI',
  '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
  '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP'
]);
```

## Unsubscription

### Client Unsubscription Message

```json
{
  "type": "unsubscribe",
  "room": "COIN_UPDATES",
  "data": {
    "coins": [
      "0x2::sui::SUI",
      "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
    ]
  }
}
```

### Server Unsubscription Response

```json
{
  "type": "unsubscribed",
  "room": "COIN_UPDATES",
  "data": {
    "coins": [
      "0x2::sui::SUI",
      "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
    ]
  }
}
```

> **See also:** [WebSocket Setup](/docs.noodles.fi/websocket/websocket-setup.md) for general WebSocket connection and management details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://noodles-finance.gitbook.io/docs.noodles.fi/websocket/room-coin-updates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
