{
"command": "<string>",
"identifier": "<string>"
}{
"command": "<string>",
"identifier": "<string>",
"data": "<string>"
}{
"c": "G5",
"n": "eth",
"pa": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"m5": {
"b": 42,
"s": 36,
"by": 40,
"sl": 31,
"bvo": 15193.078597182,
"svo": 43904.4937286058
},
"m15": {
"b": 122,
"s": 107,
"by": 96,
"sl": 82,
"bvo": 114599.310956502,
"svo": 142538.913095514
},
"m30": {
"b": 312,
"s": 269,
"by": 191,
"sl": 173,
"bvo": 446949.800347959,
"svo": 238371.748663375
},
"h1": {
"b": 534,
"s": 422,
"by": 260,
"sl": 255,
"bvo": 887478.427468627,
"svo": 520519.921639103
},
"h6": {
"b": 1410,
"s": 1220,
"by": 580,
"sl": 519,
"bvo": 3710174.1254709,
"svo": 3797551.66291745
},
"h24": {
"b": 3544,
"s": 3424,
"by": 1305,
"sl": 1304,
"bvo": 13539384.9948402,
"svo": 13828012.0768187
},
"t": 1790552626
}OnchainPoolStats
Real-time rolling buy/sell stats by pool address
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 isbvo−svo.
Pushed when a pool’s stats change, about 7 seconds after a swap.
Data Payload
| Key | Field | Type | Description | Example |
|---|---|---|---|---|
c | channel_type | string | Channel type subscribed to. | G5 |
n | network_id | string | Blockchain network identifier. | eth |
pa | pool_address | string | Pool contract address. | 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 |
m5, m15, m30, h1, h6, h24 | window | object | Stats for each rolling window: 5m, 15m, 30m, 1h, 6h, 24h. | – |
{window}.b | buys | number | Buy trades in the window. | 42 |
{window}.s | sells | number | Sell trades in the window. | 36 |
{window}.by | buyers | number | Unique buyers in the window. | 40 |
{window}.sl | sellers | number | Unique sellers in the window. | 31 |
{window}.bvo | buy_volume_usd | number | Buy volume in USD. | 15193.08 |
{window}.svo | sell_volume_usd | number | Sell volume in USD. | 43904.49 |
t | timestamp | integer | UNIX timestamp (s) of the stats snapshot. | 1790552626 |
1. Establish Connection
wss://stream.coingecko.com/v1?x_cg_pro_api_key=YOUR_KEY
x-cg-pro-api-key: YOUR_KEY{
"code": 3000,
"message": "Connection established",
"uuid": "YOUR_SESSION_ID"
}
{
"type": "welcome",
"sid": "YOUR_SESSION_ID"
}
2. Subscribe to OnchainPoolStats
Input:{"command":"subscribe","identifier":"{\"channel\":\"OnchainPoolStats\"}"}
{
"type": "confirm_subscription",
"identifier": "{\"channel\":\"OnchainPoolStats\"}"
}
3. Stream Pool Stats
Input:{"command":"message","identifier":"{\"channel\":\"OnchainPoolStats\"}","data":"{\"network_id:pool_addresses\":[\"eth:0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640\"],\"action\":\"set_pools\"}"}
{
"code": 2000,
"message": "Subscription successful for eth:0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
}
{
"c": "G5",
"n": "eth",
"pa": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"m5": { "b": 42, "s": 36, "by": 40, "sl": 31, "bvo": 15193.078597182, "svo": 43904.4937286058 },
"m15": { "b": 122, "s": 107, "by": 96, "sl": 82, "bvo": 114599.310956502, "svo": 142538.913095514 },
"m30": { "b": 312, "s": 269, "by": 191, "sl": 173, "bvo": 446949.800347959, "svo": 238371.748663375 },
"h1": { "b": 534, "s": 422, "by": 260, "sl": 255, "bvo": 887478.427468627, "svo": 520519.921639103 },
"h6": { "b": 1410, "s": 1220, "by": 580, "sl": 519, "bvo": 3710174.1254709, "svo": 3797551.66291745 },
"h24": { "b": 3544, "s": 3424, "by": 1305, "sl": 1304, "bvo": 13539384.9948402, "svo": 13828012.0768187 },
"t": 1790552626
}
4. Unsubscribe
Unsubscribe from a specific pool:{"command":"message","identifier":"{\"channel\":\"OnchainPoolStats\"}","data":"{\"network_id:pool_addresses\":[\"eth:0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640\"],\"action\":\"unset_pools\"}"}
{
"code": 2000,
"message": "Unsubscription is successful for eth:0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"
}
{"command":"unsubscribe","identifier":"{\"channel\":\"OnchainPoolStats\"}"}
{
"code": 2000,
"message": "Unsubscription is successful for all pools"
}
{
"command": "<string>",
"identifier": "<string>"
}{
"command": "<string>",
"identifier": "<string>",
"data": "<string>"
}{
"c": "G5",
"n": "eth",
"pa": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"m5": {
"b": 42,
"s": 36,
"by": 40,
"sl": 31,
"bvo": 15193.078597182,
"svo": 43904.4937286058
},
"m15": {
"b": 122,
"s": 107,
"by": 96,
"sl": 82,
"bvo": 114599.310956502,
"svo": 142538.913095514
},
"m30": {
"b": 312,
"s": 269,
"by": 191,
"sl": 173,
"bvo": 446949.800347959,
"svo": 238371.748663375
},
"h1": {
"b": 534,
"s": 422,
"by": 260,
"sl": 255,
"bvo": 887478.427468627,
"svo": 520519.921639103
},
"h6": {
"b": 1410,
"s": 1220,
"by": 580,
"sl": 519,
"bvo": 3710174.1254709,
"svo": 3797551.66291745
},
"h24": {
"b": 3544,
"s": 3424,
"by": 1305,
"sl": 1304,
"bvo": 13539384.9948402,
"svo": 13828012.0768187
},
"t": 1790552626
}CoinGecko API key
Subscribe to the OnchainPoolStats channel
Subscription command
subscribeJSON string specifying the target channel
Set pools to receive rolling stats updates for
Message command
messageJSON string specifying the target channel
JSON string with network_id:pool_addresses array, format: network_id:pool_address
Rolling pool buy/sell stats update from server
Channel type
Network identifier
Pool contract address
Rolling 5m stats
Buy trades in the window
Sell trades in the window
Unique buyers in the window
Unique sellers in the window
Buy volume in USD
Sell volume in USD
Rolling 15m stats
Buy trades in the window
Sell trades in the window
Unique buyers in the window
Unique sellers in the window
Buy volume in USD
Sell volume in USD
Rolling 30m stats
Buy trades in the window
Sell trades in the window
Unique buyers in the window
Unique sellers in the window
Buy volume in USD
Sell volume in USD
Rolling 1h stats
Buy trades in the window
Sell trades in the window
Unique buyers in the window
Unique sellers in the window
Buy volume in USD
Sell volume in USD
Rolling 6h stats
Buy trades in the window
Sell trades in the window
Unique buyers in the window
Unique sellers in the window
Buy volume in USD
Sell volume in USD
Rolling 24h stats
Buy trades in the window
Sell trades in the window
Unique buyers in the window
Unique sellers in the window
Buy volume in USD
Sell volume in USD
UNIX timestamp in seconds
Was this page helpful?

