erdewit / ib_insync

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

could every request to run as it's own thread? #183

Closed viponedream closed 5 years ago

viponedream commented 5 years ago

Is now the framwork run in one thread? sorry for my poor English. For example, if i put the ib_insync in my trading system. then i request the reqHistorical(each request must wait secs) that may take a long time. it will suspend the whole trading system. another market stream will missing. So i think all the requests like reqContract, reqHistorical to run in it's own thread.

The final trading system is no matter how long the reqeust takes. it won't affect to the main tread.

Can we do that?

erdewit commented 5 years ago

To run requests concurrently there are the *Async methods, such as reqHistoricalAsync. This does require knowledge of async programming though.