Streaming Real-Time Data
WebSocket endpoint for consolidated real-time normalized market data streaming
WebSocket /ws-stream-normalized?options={options}
WebSocket /ws-stream-normalized?options={options}import asyncio
import aiohttp
import json
import urllib.parse
async def main():
data_types = ["trade", "book_change", "book_snapshot_10_100ms"]
stream_options = [
{
"exchange": "binance",
"symbols": ["btcusdt"],
"dataTypes": data_types,
},
{
"exchange": "binance-futures",
"symbols": ["BTCUSDT"],
"dataTypes": data_types,
},
]
options = urllib.parse.quote_plus(json.dumps(stream_options))
URL = f"ws://localhost:8001/ws-stream-normalized?options={options}"
# real-time normalized data for two exchanges via single connection
async with aiohttp.ClientSession() as session:
async with session.ws_connect(URL) as websocket:
async for msg in websocket:
print(msg.data)
asyncio.run(main())Stream normalized options
name
type
default
description
Response format & sample messages
Last updated
Was this helpful?