Why can't I get reliable info from TWS

CurrSize = ibc.GetPositionSize( Ticker );

This simple call can often allow multi-minutes to pass before returning the correct value --- although correct value is displayed in the TWS window.

How should a programmer deal with such behavior?

Not minutes but seconds. Also it is beyond control of end application. Everything is under Interactive Brokers (TWS) control. IBController returns whatever is sent by TWS and at times when TWS sends it. TWS is pretty "lazy" in sending account updates. Usually they occur with at least 1 second delay.

Instead of using "Account" information that is by Interactive Brokers intended to be for your EYES, not for your auto-trading, track your orders and execution. Order updates are orders of magnitude more frequent.

Thank you Mr. Tomasz.

I have written code (in Amibroker) to auto-trade markets, from my Interactive Broker account. I am using the IB_Controller that I downloaded from the Amibroker website.

So, you are telling me that TWS is "lazy" to the point that my auto-trade code is ineffective?

Mr. Tomasz, how does this strengthen your brand?

Yes, I compute my own values (as you suggested). It would still be unprofessional for me to NOT compare my calculations with those being "presented" by TWS.

What am I missing here?

Here is the deal:

If the size that you internally calculate is NOT equal to the size that your broker is reporting, then you have a major problem.

I might be cool with a "temporary" imbalance. I'm uncool with an imbalance that spans longer than the base interval.

You know:

AB can blame IB.
IB can blame AB.

I simply want a solution! This is simply not "workable" as currently constructed.

You are saying utter nonsense about "blaming". I don't "blame" Interactive Brokers.
I am giving you FACTS, not opinions.

Contrary to IB software, IBController is OPEN SOURCE you can check YOURSELF if there is any hidden "delay" in account updates. There isn't.

Account page code:

Do you see any delay anywhere in the IBController code?
No because there isn't anything there.

IBController can't create data that you are supposed to get from Interactive Brokers. They are NOT sending it as frequently as you want and thats just plain fact. You can say utter nonsense on the internet but I am allergic to nonsense.

So don't create a false picture. When I say that it is INTERACTIVE BROKERS who sends account updates that is not opinion. It is a hard fact.

In fact it is DOCUMENTED by Interactive Brokers that they are SLOW to send updates, see IB's OWN DOCUMENTATION:


This information is the exact same as the one displayed within the TWS' Account Window


Just as with the TWS' Account Window, unless there is a position change this information is updated at a fixed interval of three minutes.

These are Interactive Brokers OWN WORDS.

So give me a break about "blame". Read their OWN documentation and stop saying nonsense. If you want faster updates from TWS you need to convince Interactive Brokers to change their software (TWS).