This Websocket channel allows you to subscribe to real-time OHLCV updates of a pool.
  • Lookup by Network + Pool Address
  • It will return Open, High, Low, Close price and Volume data the specified pool.
Update Frequency: as fast as 1s, for actively traded pools. Tips: use this Rest API endpoint Top Pools by Token Address to obtain contract address of the most liquid pool.

Notes

  • Interval options: 1s / 1m / 5m / 1h / 2h / 4h / 8h
  • You may stream the pool ohlcv data based on base or quote token of a pool.
  • Please note that your subscription quota is based on the number of unique data streams you request. Each unique combination of an interval and token for a given pool is considered a distinct subscription and will count towards your max subscription limit.

Data Payload

FieldTypeDescriptionExample
chchannel_typestringIndicates the type of channel subscribed to.G3
nnetwork_idstringIdentifier of the blockchain network. Check full list of IDs here.eth
papool_addressstringContract address of the pool.0x88e6a0c2dd6fcb..3f5640
totokenstringbase or quote tokenbase
iintervalstringInterval or resolution of the candle: 1s / 1m / 5m / 1h / 2h / 4h / 8h1m
oopenfloatOpen price in USD3539
hhighfloatHigh price in USD3541
llowfloatLow price in USD3530
cclosefloatClose price in USD3531
vvolumefloatVolume in USD323333
ttimestampintegerOpening timestamp of candle interval1753803600
Tips: The Websocket payload will use the value null when specific data is unavailable. Ensure your application is capable of handling null values for fields that may not always have data.

1. Establish Connection to Websocket

wss://stream.coingecko.com/v1?x_cg_pro_api_key=YOUR_KEY

OR

wss://stream.coingecko.com/v1  
x-cg-pro-api-key: YOUR_KEY

2. Subscribe to a specific channel - OnchainOHLCV

Input Example:
{"command":"subscribe","identifier":"{\"channel\":\"OnchainOHLCV\"}"}
Output Example:
{"type":"confirm_subscription","identifier":"{\"channel\":\"OnchainOHLCV\"}"}

3. Stream OnchainOHLCV data

Input Example: (1 minute interval and base token of a pool)
  • Interval options: 1s / 1m / 5m / 1h / 2h / 4h / 8h
  • You may stream the pool ohlcv data of ‘base’ or ‘quote’ token.
{"command":"message","identifier":"{\"channel\":\"OnchainOHLCV\"}","data":"{\"network_id:pool_addresses\":[\"bsc:0x172fcd41e0913e95784454622d1c3724f546f849\"],\"interval\":\"1m\",\"token\":\"base\",\"action\":\"set_pools\"}"}
Output Example:
{
  "code": 2000,
  "message": "Subscription successful for bsc:0x172fcd41e0913e95784454622d1c3724f546f849:1m:base"
}
Output Example:
{
    "c": 0.999727235252031,
    "ch": "G3",
    "h": 0.999974654065411,
    "i": "1m",
    "l": 0.999353212178554,
    "n": "bsc",
    "o": 0.999570907451071,
    "pa": "0x172fcd41e0913e95784454622d1c3724f546f849",
    "t": 1753886760,
    "to": "base",
    "v": 63932.29404921795
}
The output keys will be in random order.

Tips:

Un-subscribe to stop streaming OnchainOHLCV data

Input Example: Unsubscribe for 1 specific pool data:
{"command":"message","identifier":"{\"channel\":\"OnchainOHLCV\"}","data":"{\"network_id:pool_addresses\":[\"eth:0xc7bbec68d12a0d1830360f8ec58fa599ba1b0e9b\"],\"interval\":\"1m\",\"token\":\"base\",\"action\":\"unset_pools\"}"}
Output Example:
{
  "code":2000,
  "message":"Unsubscription is successful for eth:0xc7bbec68d12a0d1830360f8ec58fa599ba1b0e9b:1m:base"
}
Input Example: Unsubscribe from OnchainOHLCV channel and all pools data:
{"command":"unsubscribe","identifier":"{\"channel\":\"OnchainOHLCV\"}"}
Output Example:
{
  "code":2000,
  "message":"Unsubscription is successful for all pools"
}