My application uses the event updatePortfolioEx after call to IBApi.EClient.reqAccountUpdates periodically to fetch the portfolio changes. However I found it not very timely reliable, especially after a few hours running since TWS launched. Quite often my application won't get updating after the order was executed for tens of minutes. Sometimes I manually click the "reconnect all farms" button in the "connection" window would help to wake up the API in a short period before it goes to sleep again. Is anyone here seeing the same thing? Any suggestions to fix / walk around? Thanks.
What is updatePortfolioEx? I have not heard of this API call and can't find it in the overview here: https://interactivebrokers.github.io/tws-api/positions.html
For reqAccountUpdates you should listen to: - UpdateAccountValue: Will give you one update per field in your account. - UpdatePortfolio: Will give you positions per contract
reqAccountUpdates isn't called periodically. You call it once with a boolean. Afterwards you cancel it with a boolean. Sounds like you keep making unnecessary requests until IB stops responding to duplicate ones.