SDK WebSocket Usage
Live subscriptions and replay in the SDKs follow the same socket model as the WebSocket docs.
Official clients for the core API in Python, TypeScript, and Rust.
WebSocket usage
The same client handles live subscriptions and replay.
import asynciofrom oxarchive import OxArchiveWs, WsOptions
async def main(): ws = OxArchiveWs(WsOptions(api_key="0xa_your_api_key"))
# Subscribe to real-time data ws.on_orderbook(lambda coin, data: print(f"{coin}: {data.mid_price}"))
await ws.connect() ws.subscribe_orderbook("BTC")
# Or replay historical data await ws.replay("orderbook", "BTC", start=1704067200000, speed=10)
asyncio.run(main())