Can anyone please help with asyncio? I'm using it to connect to Binance websockets. The example below is for one API key. I need to receive messages for several API keys.
Question: is it possible to do this within the same main() without creating a separate file for each API key?
async def main():
client = await AsyncClient.create(APIkey1, APIsecret1)
bm = BinanceSocketManager(client)
# start any sockets here, i.e a trade socket
ts = bm.trade_socket('BNBBTC')
# then start receiving messages
async with ts as tscm:
while True:
res = await tscm.recv()
print(res)
await client.close_connection()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())