Order Book
Real-time best bid, best ask, and last chance updates
Last updated
Was this helpful?
Was this helpful?
{
"t": "SUBSCRIBE",
"e": "54ccea1a-16fd-469c-8018-84b375243e8a"
}{
"t": "SUBSCRIBED",
"e": "54ccea1a-16fd-469c-8018-84b375243e8a"
}{
"t": "PRICES_DATA",
"e": "54ccea1a-16fd-469c-8018-84b375243e8a",
"d": [
{
"o": "b21f6fd8-b9d1-4b9f-bb79-ef141e3dcb76",
"c": 0.55,
"b": 0.54,
"a": 0.56
}
]
}import asyncio, json, websockets
async def order_book():
uri = "wss://order-book.outpoll.com/event/ws"
async with websockets.connect(uri) as ws:
await ws.send(json.dumps({
"t": "SUBSCRIBE",
"e": "54ccea1a-16fd-469c-8018-84b375243e8a",
}))
async for msg in ws:
data = json.loads(msg)
if data["t"] in ("PRICES_DATA", "PRICES_DATA_DELTA"):
for price in data["d"]:
print(price["o"], price["c"], price["b"], price["a"])