sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.89k stars 2.2k forks source link

socket problem #1328

Open Hlulucas opened 1 year ago

Hlulucas commented 1 year ago

Hello, I can't figure out which socket should I use so that my code below returns me the transactions and cancellations of several traders that I identify on binance. Can someone help me please ?

import asyncio import json

from binance import AsyncClient, BinanceSocketManager

async def user_listener(client): bm = BinanceSocketManager(client) async with bm.trade_socket('BTCUSD') as tscm: while True: res = await tscm.recv() print(res)

async def main():

client = await AsyncClient.create()
await user_listener(client)

if name == "main":

loop = asyncio.get_event_loop()
loop.run_until_complete(main())