Skip to main content
WSS

Notes

  • Streams real-time price and market data for tokens by network and token address.
  • Returns data from the top pool of the specified token.
  • Lookup format: network_id:token_address (e.g. bsc:0x55d398326f99059ff775485246999027b3197955).
  • Find supported network IDs via Networks List.
  • Fields may return null when data is unavailable. Ensure your application handles null values.
Update Frequency:
As fast as ~1 second for actively traded tokens.

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 OnchainSimpleTokenPrice

Input:
Output:

3. Stream Token Price Data

Input:
Output:
Streaming output:
Output keys may appear in any order.

4. Unsubscribe

Unsubscribe from a specific token:
Unsubscribe from the channel entirely:

x_cg_pro_api_key
type:httpApiKey

CoinGecko API key

Subscribe to OnchainSimpleTokenPrice
type:object

Subscribe to the OnchainSimpleTokenPrice channel

command
type:enum
required

Subscription command

Available options: subscribe
identifier
type:string
required

JSON string specifying the target channel

Stream OnchainSimpleTokenPrice Data
type:object

Set tokens to receive price 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:token_addresses array, format: network_id:token_address

OnchainSimpleTokenPrice Update
type:object

Real-time onchain token price update from server

c
type:string

Channel type

n
type:string

Network identifier

ta
type:string

Token contract address

p
type:number

Token price in USD

pp
type:number

24h price change percentage

m
type:number

Market cap in USD

v
type:number

24h trading volume in USD

t
type:integer

UNIX timestamp in seconds