WebSocket (Beta)

CoinGecko API: Real-Time Crypto Data with WebSockets

Access Real-Time Crypto Data Instantly with CoinGecko WebSockets

In the fast-paced world of cryptocurrency, speed matters. Our official CoinGecko WebSocket API provides a dedicated, persistent connection for real-time data streaming, ensuring you receive critical market updates the moment they happen. Move beyond traditional polling and embrace the power of instant data delivery for your trading bots, dashboards, and analytical applications.

  • CoinGecko Websocket is now exclusively available as optional add-ons for Enterprise plan clients only.
  • For existing Enterprise plan clients, kindly contact the CoinGecko team to confirm your Websocket access, maximum limits for socket connections, and subscriptions per socket.
  • If you're interested to join Websocket trial, please submit your interest here. You may reach out to soonaik@coingecko[dot]com for feedback & suggestions.

Channel & Data Support

Websocket ChannelChannel CodeDetails
OnchainSimpleTokenPriceG1Subscribe to receive real-time price updates for tokens, as seen on GeckoTerminal.com
CGSimplePriceC1Subscribe to receive real-time price updates for tokens, as seen on CoinGecko.com
OnchainTradeG2Subscribe to receive real-time transaction updates for pools, as seen on GeckoTerminal.com
[OnchainOHLCV]G3Subscribe to receive real-time OHLCV (Open, High, Low, Close, Volume) for pools, as seen on GeckoTerminal.com
(More coming soon!)

Notes:

  • Real-Time Data: Once subscribed, you will start receiving real-time data updates based on your subscriptions. The received data will be in JSON format and will contain the relevant information for the subscribed event.
  • Close Connection: When you're done receiving updates or want to close the WebSocket connection, you can gracefully close the connection.
  • Security Considerations: Ensure that you keep your Pro-API key secure and do not expose it publicly in your code or any public repositories.

Connection Handling:

To provide you with the most reliable and efficient experience, please be aware of the following regarding our WebSocket connections:

  1. Connection Liveliness (Ping/Pong Mechanism):
    • To ensure your connection remains active and healthy, we send a "ping" signal every 10 seconds.
    • If we do not receive a "pong" response from your client within 20 seconds of sending a ping, we will automatically disconnect the connection.
    • Action Required (Client-Side): Your WebSocket client must be configured to respond to our ping messages with a pong. Most WebSocket libraries handle this automatically, but please verify your implementation to ensure it's sending pong responses. This is critical for maintaining your connection.
  2. Planned Disconnections (Deployments & Reboots):
    • Purpose: From time to time, we will perform system reboots or deploy new versions of our service to implement updates, bug fixes, and improvements. These actions require a graceful restart of our servers.
    • Impact: During these periods, your active WebSocket connections might be temporarily disconnected.
    • Action Required (Client-Side): It is essential that your application is designed to automatically attempt to re-establish the WebSocket connection if it detects a disconnection. Implementing an exponential backoff strategy for reconnection attempts is highly recommended to avoid overwhelming our servers during a widespread disconnection event.