¿ªÔÆÌåÓý

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

Re: reqPositions not returning all positions


 

On Mon, Sep 25, 2023 at 11:02 AM, chris.bauch@... wrote:

thanks, not sure how to do that....

It's not much different. Search for positionEnd in the sample code provided w/ the API (IBJts/samples/Python/Testbed/Program.py) and you'll see how to add it to your program.

At the same time keep in mind that IB API programs are built on a client/server model and you'll rely on the messaging pattern a lot. Given the nature of your issue I'm guessing this isn't second nature yet.

So keep in mind, whenever you see a call which looks like reqThis or reqThat, the response data should come back some (short?) time later via another function or method... often named simply this or that.

Given most calls are network based, this will hold true (in some sense) even if the naming doesn't always fulfill that convention. Your code seems to be reading the position responses correctly, so positionEnd may be an example of such an exception and the reason for the mix up. Anyway...

What you should absolutely not get in the habit of doing is making a request and then sleeping with the expectation that a response will show in time. It's been said a million times before on this list and here is yet another reminder... sleep is a terrible method of synchronization and should be avoided for such purposes.

With that out of the way, and since you're a Python user, I also suggest trying Ewald de Wit's . It does a great job of hiding these network details when they're not strictly necessary, and exposing them via coroutines when they are. For example, you'd be able to easily access your positions in a traditional, rich client, manner by simply calling .

Of course YMMV. Good luck.

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