erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.8k stars 743 forks source link

[info] nest-asyncio 1.3.0 #222

Closed gp-slick-coder closed 4 years ago

gp-slick-coder commented 4 years ago

Just to let you know.

I got the following error with nest-asyncio 1.3.0: RuntimeError: Cannot run the event loop while another loop is running

Working libs with tornado are: nest-asyncio==1.2.3 tornado==5.1.1 ib_insync==0.9.59

erdewit commented 4 years ago

The error indicates that another new event loop has been created. For example asyncio.run does this. My suggestion would be to make sure to use only one event loop.

In the stack of tornado + ib_insync there should be no need for nest-asyncio btw, it can be made full async.

gp-slick-coder commented 4 years ago

Thanks, you are right! I removed nest_asyncio.apply() and changed the synchronous function qualifyContracts to qualifyContractsAsync. Everything works fine now :-) Also tornado 6.* is working... lol, what a day^^