Skip to content
Advertisement

Tag: python-asyncio

missing some messages in websocket client?

I am trying to implement a websocket client that connects to the popular crypto exchange FTX. I have simplified my problem to the following example code below: The output of the program overall is as expected, but with one major problem: the cumulative trading volume that gets output to the console is WAY too low. It should be about 1,000x-10,000x

Python asyncio loop.run_forever()

I try to do a trading bot and the most things work fine. But everytime the internet connection is gone for a short time, the code fails. I use asyncio run_forever() function and I think that the code should run forever until it gets stopped, but it does not work. Here is my code: And I call the loop like

python asyncio.create_task tasks exiting earlier than expected?

I have the following code: It outputs: Notice that world isn’t printed anywhere. Why is the output we see being produced? I was expecting: Because I thought that the asyncio.sleep(i) calls would yield execution to the event loop, at which point the event loop would reschedule them after their respective wait times. Clearly I am misunderstanding. Can someone explain? Answer

Asyncio combined with custom modules and aiohttp

I am trying to sleep a module for a couple seconds, while sleeping, the script should continue running. When the sleep is over, the module should put data[“found”] = True, but the code never reaches past asyncio.sleep() The code should print: “bulbasaur” “do stuff” x 5 “bulbasaur” But bulbasaur never comes back. main.py: pokemon.py: nba.py Answer The issue lies in

How to detect closed websocket in asyncio.gather(*tasks)

I have a list of asyncio tasks which contains with connecting,handshaking and receiving data from a websocket. This process is running correctly but sometimes the connection of one of the websocket (or maybe all of them) is closed. How can I detect and make a new conncetion to the closed one? Here is the code which I use: According to

Advertisement