Skip to main content
WSS

Notes

  • Streams rolling buy/sell stats for pools by network and pool address, the same stats returned by Specific Pool Data by Pool Address.
  • Lookup format: network_id:pool_address (e.g. eth:0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640).
  • Find supported network IDs via Networks List.
  • Stats are from the base token’s perspective.
  • All six windows are sent in every message.
  • Total volume is bvo + svo. Net buy volume is bvo − svo.
Update Frequency:
Pushed when a pool’s stats change, about 7 seconds after a swap.

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 OnchainPoolStats

Input:
Output:

3. Stream Pool Stats

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 OnchainPoolStats
type:object

Subscribe to the OnchainPoolStats channel

command
type:enum
required

Subscription command

Available options: subscribe
identifier
type:string
required

JSON string specifying the target channel

Stream OnchainPoolStats Data
type:object

Set pools to receive rolling stats 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

OnchainPoolStats Update
type:object

Rolling pool buy/sell stats update from server

c
type:string

Channel type

n
type:string

Network identifier

pa
type:string

Pool contract address

m5
type:object

Rolling 5m stats

b
type:number

Buy trades in the window

s
type:number

Sell trades in the window

by
type:number

Unique buyers in the window

sl
type:number

Unique sellers in the window

bvo
type:number

Buy volume in USD

svo
type:number

Sell volume in USD

m15
type:object

Rolling 15m stats

b
type:number

Buy trades in the window

s
type:number

Sell trades in the window

by
type:number

Unique buyers in the window

sl
type:number

Unique sellers in the window

bvo
type:number

Buy volume in USD

svo
type:number

Sell volume in USD

m30
type:object

Rolling 30m stats

b
type:number

Buy trades in the window

s
type:number

Sell trades in the window

by
type:number

Unique buyers in the window

sl
type:number

Unique sellers in the window

bvo
type:number

Buy volume in USD

svo
type:number

Sell volume in USD

h1
type:object

Rolling 1h stats

b
type:number

Buy trades in the window

s
type:number

Sell trades in the window

by
type:number

Unique buyers in the window

sl
type:number

Unique sellers in the window

bvo
type:number

Buy volume in USD

svo
type:number

Sell volume in USD

h6
type:object

Rolling 6h stats

b
type:number

Buy trades in the window

s
type:number

Sell trades in the window

by
type:number

Unique buyers in the window

sl
type:number

Unique sellers in the window

bvo
type:number

Buy volume in USD

svo
type:number

Sell volume in USD

h24
type:object

Rolling 24h stats

b
type:number

Buy trades in the window

s
type:number

Sell trades in the window

by
type:number

Unique buyers in the window

sl
type:number

Unique sellers in the window

bvo
type:number

Buy volume in USD

svo
type:number

Sell volume in USD

t
type:integer

UNIX timestamp in seconds