Messages
{
"command": "<string>",
"identifier": "<string>"
}{
"command": "<string>",
"identifier": "<string>",
"data": "<string>"
}{
"ch": "G3",
"n": "bsc",
"pa": "0x172fcd41e0913e95784454622d1c3724f546f849",
"to": "base",
"i": "1m",
"o": 1.00052534269941,
"h": 1.00063525778742,
"l": 0.999952061655863,
"c": 0.999952061655863,
"v": 59672.13452671968,
"t": 1780841100
}Charts
OnchainOHLCV
Real-time onchain OHLCV candlestick updates by pool address
WSS
/
v1
Notes
- Streams real-time OHLCV (Open, High, Low, Close, Volume) candlestick data by network and pool address.
- Lookup format:
network_id:pool_address(e.g.bsc:0x172fcd41e0913e95784454622d1c3724f546f849). - Interval options:
1s/1m/5m/15m/1h/2h/4h/8h/12h/1d. - Stream based on
baseorquotetoken of a pool. - Find supported network IDs via Networks List.
- Use Top Pools by Token Address to find the most liquid pool address.
- Fields may return
nullwhen data is unavailable. Ensure your application handles null values.
Each unique combination of interval and token for a given pool counts as a distinct subscription towards your max subscription limit.
Update Frequency:
As fast as ~1 second for actively traded pools.
As fast as ~1 second for actively traded pools.
Data Payload
| Key | Field | Type | Description | Example |
|---|---|---|---|---|
ch | channel_type | string | Channel type subscribed to. | G3 |
n | network_id | string | Blockchain network identifier. | bsc |
pa | pool_address | string | Pool contract address. | 0x172fcd41e0913e95784454622d1c3724f546f849 |
to | token | string | Token side (base or quote). | base |
i | interval | string | Candle interval. | 1m |
o | open | number | Open price in USD. | 1.0005 |
h | high | number | High price in USD. | 1.0006 |
l | low | number | Low price in USD. | 0.9999 |
c | close | number | Close price in USD. | 0.9999 |
v | volume | number | Volume in USD. | 59672.13 |
t | timestamp | integer | Candle open time, UNIX timestamp (s). | 1780841100 |
1. Establish Connection
wss://stream.coingecko.com/v1?x_cg_pro_api_key=YOUR_KEY
You can also pass the key as a header:
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 OnchainOHLCV
Input:{"command":"subscribe","identifier":"{\"channel\":\"OnchainOHLCV\"}"}
{
"type": "confirm_subscription",
"identifier": "{\"channel\":\"OnchainOHLCV\"}"
}
3. Stream OHLCV Data
Input:{"command":"message","identifier":"{\"channel\":\"OnchainOHLCV\"}","data":"{\"network_id:pool_addresses\":[\"bsc:0x172fcd41e0913e95784454622d1c3724f546f849\"],\"interval\":\"1m\",\"token\":\"base\",\"action\":\"set_pools\"}"}
{
"code": 2000,
"message": "Subscription successful for bsc:0x172fcd41e0913e95784454622d1c3724f546f849:1m:base"
}
{
"ch": "G3",
"n": "bsc",
"pa": "0x172fcd41e0913e95784454622d1c3724f546f849",
"to": "base",
"i": "1m",
"o": 1.00052534269941,
"h": 1.00063525778742,
"l": 0.999952061655863,
"c": 0.999952061655863,
"v": 59672.13452671968,
"t": 1780841100
}
Output keys may appear in any order.
4. Unsubscribe
Unsubscribe from a specific pool:{"command":"message","identifier":"{\"channel\":\"OnchainOHLCV\"}","data":"{\"network_id:pool_addresses\":[\"bsc:0x172fcd41e0913e95784454622d1c3724f546f849\"],\"interval\":\"1m\",\"token\":\"base\",\"action\":\"unset_pools\"}"}
{
"code": 2000,
"message": "Unsubscription is successful for bsc:0x172fcd41e0913e95784454622d1c3724f546f849:1m:base"
}
{"command":"unsubscribe","identifier":"{\"channel\":\"OnchainOHLCV\"}"}
{
"code": 2000,
"message": "Unsubscription is successful for all pools"
}
Messages
{
"command": "<string>",
"identifier": "<string>"
}{
"command": "<string>",
"identifier": "<string>",
"data": "<string>"
}{
"ch": "G3",
"n": "bsc",
"pa": "0x172fcd41e0913e95784454622d1c3724f546f849",
"to": "base",
"i": "1m",
"o": 1.00052534269941,
"h": 1.00063525778742,
"l": 0.999952061655863,
"c": 0.999952061655863,
"v": 59672.13452671968,
"t": 1780841100
}x_cg_pro_api_key
type:httpApiKey
CoinGecko API key
Subscribe to OnchainOHLCV
type:object
Subscribe to the OnchainOHLCV channel
Stream OnchainOHLCV Data
type:object
Set pools to receive OHLCV updates for
OnchainOHLCV Update
type:object
Real-time OHLCV candlestick update from server
Was this page helpful?
⌘I

