{
"command": "<string>",
"identifier": "<string>"
}{
"command": "<string>",
"identifier": "<string>",
"data": "<string>"
}{
"c": "C1",
"i": "bitcoin",
"vs": "usd",
"p": 61696.68,
"pp": 1.42,
"pp7d": 3.8214,
"pp30d": -2.1543,
"pp60d": 12.4512,
"pp1y": 120.8541,
"m": 1236047139289.68,
"cs": 19734150,
"fdv": 1312500000000,
"v": 30595921115.54,
"t": 1780839768
}CGSimplePrice
Real-time coin price updates by CoinGecko coin IDs
Notes
- Streams real-time prices for one or more coins by their unique Coin API IDs.
- Specify preferred quote currencies via
vs_currenciesin the subscription data. See Supported Currencies for valid values. Defaults to USD. - Find a coin’s API ID on its CoinGecko page, via Coins List, or this Google Sheet.
- Fields may return
nullwhen data is unavailable. Ensure your application handles null values.
As fast as ~10 seconds for large-cap and actively traded coins.
Data Payload
| Key | Field | Type | Description | Example |
|---|---|---|---|---|
c | channel_type | string | Channel type subscribed to. | C1 |
i | coin_id | string | Coin identifier. | bitcoin |
vs | vs_currency | string | Target quote currency. | usd |
p | price | number | Current price in the specified vs_currency. | 61696.68 |
pp | price_24h_change_percentage | number | Price change percentage over the last 24 hours. | 1.42 |
pp7d | price_7d_change_percentage | number | Price change percentage over the last 7 days. | 3.8214 |
pp30d | price_30d_change_percentage | number | Price change percentage over the last 30 days. | -2.1543 |
pp60d | price_60d_change_percentage | number | Price change percentage over the last 60 days. | 12.4512 |
pp1y | price_1y_change_percentage | number | Price change percentage over the last 1 year. | 120.8541 |
m | market_cap | number | Market capitalization in the specified vs_currency. | 1236047139289.68 |
cs | circulating_supply | number | Circulating supply of coin. | 19734150 |
fdv | fully_diluted_value | number | Fully diluted valuation in the specified vs_currency. | 1312500000000 |
v | 24h_vol | number | 24-hour trading volume in the specified vs_currency. | 30595921115.54 |
t | last_updated_at | integer | UNIX timestamp in seconds. | 1780839768 |
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 CGSimplePrice
Input:{"command":"subscribe","identifier":"{\"channel\":\"CGSimplePrice\"}"}
{
"type": "confirm_subscription",
"identifier": "{\"channel\":\"CGSimplePrice\"}"
}
3. Stream Price Data
Input:{"command":"message","identifier":"{\"channel\":\"CGSimplePrice\"}","data":"{\"coin_id\":[\"bitcoin\"],\"vs_currencies\":[\"usd\"],\"action\":\"set_tokens\"}"}
{
"code": 2000,
"message": "Subscribed to bitcoin in usd"
}
{
"c": "C1",
"i": "bitcoin",
"vs": "usd",
"p": 61696.67928656691,
"pp": 1.4192404041947198,
"pp7d": 3.8214,
"pp30d": -2.1543,
"pp60d": 12.4512,
"pp1y": 120.8541,
"m": 1236047139289.684,
"cs": 19734150,
"fdv": 1312500000000,
"v": 30595921115.53988,
"t": 1780839768
}
4. Unsubscribe
Unsubscribe from a specific token:{"command":"message","identifier":"{\"channel\":\"CGSimplePrice\"}","data":"{\"coin_id\":[\"bitcoin\"],\"action\":\"unset_tokens\"}"}
{
"code": 2000,
"message": "Unsubscription is successful for bitcoin"
}
{"command":"unsubscribe","identifier":"{\"channel\":\"CGSimplePrice\"}"}
{
"code": 2000,
"message": "Unsubscription is successful for all tokens"
}
{
"command": "<string>",
"identifier": "<string>"
}{
"command": "<string>",
"identifier": "<string>",
"data": "<string>"
}{
"c": "C1",
"i": "bitcoin",
"vs": "usd",
"p": 61696.68,
"pp": 1.42,
"pp7d": 3.8214,
"pp30d": -2.1543,
"pp60d": 12.4512,
"pp1y": 120.8541,
"m": 1236047139289.68,
"cs": 19734150,
"fdv": 1312500000000,
"v": 30595921115.54,
"t": 1780839768
}CoinGecko API key
Subscribe to the CGSimplePrice channel
Subscription command
subscribeJSON string specifying the target channel
Set coins to receive price updates for
Message command
messageJSON string specifying the target channel
JSON string with coin_id array (required) and vs_currencies array (optional, defaults to ["usd"])
Real-time coin price update from server
Channel type
Coin identifier
Target vs_currency
Price in vs_currency
24h price change percentage
7d price change percentage
30d price change percentage
60d price change percentage
1y price change percentage
Market cap in vs_currency
Circulating supply
Fully diluted valuation in vs_currency
24h trading volume in vs_currency
UNIX timestamp in seconds
Was this page helpful?

