Skip to main content
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 base or quote token 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 null when 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.

Data Payload

KeyFieldTypeDescriptionExample
chchannel_typestringChannel type subscribed to.G3
nnetwork_idstringBlockchain network identifier.bsc
papool_addressstringPool contract address.0x172fcd41e0913e95784454622d1c3724f546f849
totokenstringToken side (base or quote).base
iintervalstringCandle interval.1m
oopennumberOpen price in USD.1.0005
hhighnumberHigh price in USD.1.0006
llownumberLow price in USD.0.9999
cclosenumberClose price in USD.0.9999
vvolumenumberVolume in USD.59672.13
ttimestampintegerCandle 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
Output:
{
  "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\"}"}
Output:
{
  "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\"}"}
Output:
{
  "code": 2000,
  "message": "Subscription successful for bsc:0x172fcd41e0913e95784454622d1c3724f546f849:1m:base"
}
Streaming output:
{
  "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"
}
Unsubscribe from the channel entirely:
{"command":"unsubscribe","identifier":"{\"channel\":\"OnchainOHLCV\"}"}
{
  "code": 2000,
  "message": "Unsubscription is successful for all pools"
}

Messages
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