erdewit / ib_insync

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

how to receive bars in background? #633

Closed avatarstones closed 1 year ago

avatarstones commented 1 year ago

For the examples in github.com/erdewit/ib_insync/blob/master/notebooks/bar_data.ipynb

After running

ib.sleep(30)

what should I do if I want to run other commands during this 30 seconds? In other words, how to run the waiting for data process ib.sleep(30) in background?

Thanks for your help!

erdewit commented 1 year ago

Instead of ib.sleep there can be a loop that issues requests, for example for historical data. The realtime bars will still keep coming in.