erdewit / ib_insync

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

Error: This event loop is already running #143

Closed yiorgosn closed 5 years ago

yiorgosn commented 5 years ago

Hi I am getting this error message now every time i run any ib_insync function with one exception: accountValues() is the only method that returns the correct data. I reached out to IB and they mentioned that they receive my calls going to them from ib_insync and they reply, so there is possibly a problem with how ib_insync is lately handling the feedback.

Other error messages i get are: Error 504, reqId -1: Not connected

When I execute method accountValues() after this error as well, it returns the correct data.

erdewit commented 5 years ago

https://github.com/erdewit/nest_asyncio

yiorgosn commented 5 years ago

Works perfect. Thank you!

crypdick commented 1 year ago

I'm having this error, even with nest_asyncio. According to the nest_asyncio docs:

Only event loops from asyncio can be patched; Loops from other projects, such as uvloop or quamash, generally can't be patched.

The stacktrace indicates ib_insync is using uvloop.

jlixfeld commented 1 year ago

Where are you seeing a reference to uvloop?

Looking at util.py, asyncio is imported and the run method calls asyncio functions.

On Sun, Mar 26, 2023 at 10:43 PM, Richard Decal @.***> wrote:

I'm having this error, even with nest_asyncio. According to the nest_asyncio docs:

Only event loops from asyncio can be patched; Loops from other projects, such as uvloop or quamash, generally can't be patched.

The stacktrace indicates ib_insync is using uvloop.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>