Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accountsummary request works only once #43

Closed
Despair2000 opened this issue Dec 3, 2018 · 12 comments
Closed

Accountsummary request works only once #43

Despair2000 opened this issue Dec 3, 2018 · 12 comments

Comments

@Despair2000
Copy link

I have a peculiar problem.

This is what is happening:

  • my program connects to the TWS/gateway
  • it request an account summary (works)
  • it runs a strategy performing several tasks through IB4m like requesting contract details, historical data and also places orders

all the above works fine.

At the end of the loop it shall request an account summary again to see if there are still enough funds available to run the strategy again on another symbol and here the program freezes. I can see in the log file that the request is send to the API correctly and also that the API answers with the correct response (the account summary) but the data never shows up in the buffer.

When I at this point exit the program and try to request an account summary manually it is the same - it does not work. To make it work again I have to issue CLEAR ALL (to remove the listener) and reconnect to the TWS (just disconnect and reconnect without clear all does not work). After reconnection it works all fine again. I can also request an account summary several times in a row without problems. But when I run the strategy again the above happens again. All works fine until the second request for an account summary when the program freezes.

So it seems like one (or several) of the IB4m-functions I call inbetween the first and second summary request screws with the listener and makes it stop working.

@softwarespartan: Somehow this reminds me of issue 34 I opened sometime ago. Back then I was trying to make IB4m work in a compiled application and also then I could see the correct request and API-answers in the gateways log file but the data never made it into the buffer.
However now this is happening with an uncompiled m-file.

Any help would be greatly appreciated!

@Despair2000
Copy link
Author

Despair2000 commented Dec 3, 2018

I just had to notice that the problem is not specific to a request of the account summary. I commented out the summary request and the program got stuck in the next loop iteration when requesting historical data in the exat same way.
Is my code maybe lacking something? Maybe that I must cancel one request before I can send a new one or something similar?

@softwarespartan
Copy link
Owner

softwarespartan commented Dec 3, 2018 via email

@Despair2000
Copy link
Author

I understand. Would be awesome if you could create a workaround of some sort.

Thanks in advance!

@Despair2000
Copy link
Author

Is there maybe a way to reset this reader from within matlab without issuing clear all? Then I could disconnect and reconnect to TWS at every loop-iteration of my strategy. A pretty crude solution but the only idea I have. :-(

@Despair2000
Copy link
Author

I now fixed this problem in a REALLY ugly way.
At the end of every loop-iteration I disconnect from the TWS then I have to issue twice (!) "clear session" (with only one clear session it does not work - I can't reconnect to the TWS) then I reconnect.

I do not like this solution but it is the best I could do. I hope there will be an update to IB4m soon that solves this bug. Actually I'm pretty amazed that I seem to be the only one with this problem.

@Tukan-Kolor
Copy link

I had a Java out of heap memory problem that would occur about once daily during the trade day. I solved it in the same brute force manner. (I probably created that problem for myself with so many historical data calls instead of subscribing to realtime data)

@softwarespartan
Copy link
Owner

softwarespartan commented Dec 6, 2018 via email

@Tukan-Kolor
Copy link

Hey nice! Thanks Abel, I am learning something new all the time.

@Despair2000
Copy link
Author

@softwarespartan: Did you have the time to look into this?

@Despair2000
Copy link
Author

I don't want to be a pain in the *** and I understand that you have other more important things to do but I'm confronted with this problem in more and more situations. Now for example I also have to disconnect (and reconnect) in the fashion mentioned above before I make an order to avoid the program freezing.
I'd be utmost grateful if you could have a look at it because it is really impairing the usability of IB4m.

Thanks in advance!

@softwarespartan
Copy link
Owner

softwarespartan commented Dec 20, 2018 via email

@softwarespartan
Copy link
Owner

softwarespartan commented Dec 24, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants