We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I made a rough prototype that works with websockets, let's try to integrate it.
import websockets import asyncio import json import requests import sys def get_listen_key(api_key): print('getting listen key') url = 'https://api.binance.com/api/v1/userDataStream' resp = requests.post(url, headers={'X-MBX-APIKEY': api_key}) return resp.json()['listenKey'] async def binance_notify(listen_key): async with websockets.connect(f'wss://stream.binance.com:9443/ws/{listen_key}') as ws: print('connected to websocket') while True: msg = await ws.recv() data = json.loads(msg) if data['e'] == 'executionReport': pair = data['s'] kind = data['S'].lower() price = data['p'] amount = data['q'] state = data['X'].lower() print(kind, amount, pair, price, state) if __name__ == '__main__': listen_key = get_listen_key(sys.argv[1]) loop = asyncio.get_event_loop() loop.run_until_complete(binance_notify(listen_key))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I made a rough prototype that works with websockets, let's try to integrate it.
The text was updated successfully, but these errors were encountered: