¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: IB question


 

Its not true that for every request type that one receives there is an end. Think market depth. But otherwise, generally Yes there is an end and yes sleep should not be used.


On Mon, Jun 14, 2021, 5:53 AM J G via <windmill_1965=[email protected]> wrote:
On Mon, Jun 14, 2021 at 12:08 AM, Rational-IM wrote:
I have searched in the past for a way to avoid the use of "time.sleep(x)" when requesting data. However, I didn't find anything useful. Would be great if someone could pitch in with a solution (maybe there is a function we can call to let us know that "there are no pending data requests"?).

Don't use sleep commands. That is not how the IB API is designed. Every request which has a limited length of data in return has an indicator that IB has sent all data which it has to reply to your request.
For example: if you request an account summary you submit a request via reqAccountSummary(). You then receive all available data via the callback accountSummary(). Once all data has been sent by IB it will send the callback accountSummaryEnd(). It is this last callback that you need to wait for, not some artificially set timer. The same structure works in case of reqHistoricalData() and other requests you may submit.

Join [email protected] to automatically receive all group messages.