Skip to main content
WSS

Notes

  • Streams real-time trade/swap updates for pools by network and pool address.
  • Returns transaction type (buy/sell), tx hash, token amounts, volume, and price data.
  • Lookup format: network_id:pool_address (e.g. bsc:0x172fcd41e0913e95784454622d1c3724f546f849).
  • Find supported network IDs via Networks List.
  • Use Top Pools by Token Address to find the most liquid pool address.
  • Fields may return null when data is unavailable. Ensure your application handles null values.
Update Frequency:
As fast as ~0.1 seconds for actively traded pools.

Data Payload


1. Establish Connection

You can also pass the key as a header: x-cg-pro-api-key: YOUR_KEY
Output:

2. Subscribe to OnchainTrade

Input:
Output:

3. Stream Trade Data

Input:
Output:
Streaming output:
Output keys may appear in any order.

4. Unsubscribe

Unsubscribe from a specific pool:
Unsubscribe from the channel entirely:

x_cg_pro_api_key
type:httpApiKey

CoinGecko API key

Subscribe to OnchainTrade
type:object

Subscribe to the OnchainTrade channel

command
type:enum
required

Subscription command

Available options: subscribe
identifier
type:string
required

JSON string specifying the target channel

Stream OnchainTrade Data
type:object

Set pools to receive trade updates for

command
type:enum
required

Message command

Available options: message
identifier
type:string
required

JSON string specifying the target channel

data
type:string
required

JSON string with network_id:pool_addresses array, format: network_id:pool_address

OnchainTrade Update
type:object

Real-time DEX trade update from server

c
type:string

Channel type

n
type:string

Network identifier

pa
type:string

Pool contract address

tx
type:string

Transaction hash

ty
type:string

Trade type (b=buy, s=sell)

to
type:number

Base token amount

toq
type:number

Quote token amount

vo
type:number

Trade volume in USD

pc
type:number

Price in quote token

pu
type:number

Price in USD

t
type:integer

UNIX timestamp in milliseconds