Room TRADE

Overview

The TRADES room provides real-time trading transaction data for specific coins. Subscribe to this room to receive live trade information including buy/sell/add_liquidity/remove_liquidity actions, amounts, prices, and transaction details.

Subscription

See: WebSocket Setup for general WebSocket connection and management details.

Client Subscription Message

{
  "type": "subscribe",
  "room": "TRADES",
  "data": {
    "coin": "0x2::sui::SUI"
  }
}

Server Response Data Format

{
  "type": "data",
  "channel": "TRADES-0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
  "room": "TRADES",
  "data": [
    {
      "action": "buy",
      "amount_in": 272.00531441,
      "amount_out": 687.537791,
      "from_coin_ident": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
      "from_coin_name": "Sui",
      "from_coin_symbol": "SUI",
      "id": 483579346,
      "price": 0.998,
      "protocol": "cetus-clmm",
      "sender": "0x7744ada2af3b150820b7bababee72b393e5c279f8d196064c3825b561ca7c7fa",
      "source": "cetus",
      "timestamp": 1761018726408,
      "to_coin_ident": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
      "to_coin_name": "USDC",
      "to_coin_symbol": "USDC",
      "tx_digest": "9ywRPpKdJ2gReSxHYbAazNY1QpzBsCSt3gy51bvBE4mx",
      "usd_value": 687.63
    },
    {
      "action": "buy",
      "amount_in": 100,
      "amount_out": 252.790872,
      "from_coin_ident": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
      "from_coin_name": "Sui",
      "from_coin_symbol": "SUI",
      "id": 483579347,
      "price": 0.998,
      "protocol": "magma-clmm",
      "sender": "0x8cfc595dcf6fcd6c1b10e6746b74d440a8118a85a196c06b084e1e3b4b0d703b",
      "source": null,
      "timestamp": 1761018726408,
      "to_coin_ident": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
      "to_coin_name": "USDC",
      "to_coin_symbol": "USDC",
      "tx_digest": "9ywRPpKdJ2gReSxHYbAazNY1QpzBsCSt3gy51bvBE4mx",
      "usd_value": 252.8
    }
  ]
}

Data Fields

Field
Type
Description

action

string

Trade action: buy or sell. Liquidity action: join (add liquidity) or exit (remove liquidity)

amount_in

number

Input amount of tokens

amount_out

number

Output amount of tokens

from_coin_ident

string

Source coin identifier

from_coin_name

string

Source coin name

from_coin_symbol

string

Source coin symbol

to_coin_ident

string

Destination coin identifier

to_coin_name

string

Destination coin name

to_coin_symbol

string

Destination coin symbol

id

number

Unique trade ID

price

number

Trade price

protocol

string

Protocol used (e.g., "cetus-clmm", "magma-clmm")

sender

string

Wallet address of sender

source

string

Source exchange/platform

timestamp

number

Trade timestamp in milliseconds

tx_digest

string

Transaction digest/hash

usd_value

number

USD value of the trade

Note: With liquidity actions (join and exit):

  • amount_in represents the amount of token from_coin_ident added/removed

  • amount_out represents the amount of token to_coin_ident added/removed.

Example Usage

JavaScript

TypeScript

Unsubscription

Client Unsubscription Message

See also: WebSocket Setup for general WebSocket connection and management details.

Last updated