Comment on page


The WebSocket API streams market updates at low latency for use cases that require monitoring of the market in real time.

Free Unlimited Access.

Base Endpoint: wss://
import sys
import websockets
import asyncio
import json
#connects to endpoint ENDPOINT
async def main():
ENDPOINT = 'wss://'
async with websockets.connect(ENDPOINT) as websocket:
await websocket.send('{"action": "subscribe", "exchange": "%s", "channel": "%s", "symbol": "%s"}' % (sys.argv[1], sys.argv[2], sys.argv[3]))
async for message in websocket:
msg = json.loads(message)
print(json.dumps(msg, indent=4, default=str))
if __name__ == "__main__":
except KeyboardInterrupt:
The Streaming service broadcasts our collected market events in real time. Our network of broadcasters collect every event in low latency as they come in over our Apache Kafka cluster, and have a shared cache of which users are subscribed to specific feeds. Leveraging API Gateway, these messages are then broadcast and streamed to users in low latencies.
When subscribing, unsubscribing, or disconnecting from the service, lambda functions activate which update a shared Redis cache containing information on what users are subscribed to. This makes the system fast, scalable, and reliable. The broadcasters are also fault-tolerant and incredibly scalable – thanks to Apache Kafka’s consumer groups, messages are distributed evenly and in the event of an outage an immediate rebalancing will occur to ensure no messages are dropped and latency is minimized. API Gateway on AWS allows for us to have full control over rate limits and throttling while constructing a streaming service that can scale up and down to meet any consumer requirements.
The only endpoint users need to subscribe to is wss://, from there the full live-streamed datasets are accessible via subscription messages. Here are a few examples:
Subscribe to all trades on Coinbase for the BTC.USD pair.
{"action": "subscribe", "channel": "trades", "exchange":"coinbase", "symbol": "BTC.USD"}
Subscribe to all swaps on Uniswap V3.
{"action": "subscribe", "channel": "dex-trades", "exchange":"uniswap-v3"}
Subscribe to all new transactions on Ethereum.
{"action": "subscribe", "channel": "ethereum-transactions"}
You can receive all of these feeds on a single connection, joining cryptocurrency data from all sources as the events occur in real time.

Technical Architecture