Created
July 7, 2020 23:17
-
-
Save sserrano44/6af5d9e977fc603a36edd26eaacf480a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import websockets | |
import base64 | |
import json | |
TOPIC = 'wss://api.exchange.ripio.com/ws/v2/consumer/non-persistent/public/default/orderbook_btc_usdc/suscription-1' | |
async def orderbook_consumer(): | |
async with websockets.connect(TOPIC) as websocket: | |
while True: | |
msg = await websocket.recv() | |
data = json.loads(msg) | |
print(base64.b64decode(data['payload'])) | |
ack = {'messageId': data['messageId']} | |
await websocket.send(ack) | |
asyncio.get_event_loop().run_until_complete(orderbook_consumer()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment