softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

Requesting open orders when there are none makes IB4m freeze #45

Closed Despair2000 closed 5 years ago

Despair2000 commented 5 years ago

Hi Abel,

I noticed today that IB4m freezes if you try to request open orders when there are none. If there are open orders everything works as it should though.

Somehow it seems that it's always me who finds the bugs. Sorry for that. :-S

Cheers

softwarespartan commented 5 years ago

No problem, thanks for raising the issue

Will have a look over the weekend

Cheers

Sent from my iPhone

On Jan 25, 2019, at 1:22 PM, Despair2000 notifications@github.com wrote:

Hi Abel,

I noticed today that IB4m freezes if you try to request open orders when there are none. If there are open orders everything works as it should though.

Somehow it seems that it's always me who finds the bugs. Sorry for that. :-S

Cheers

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

softwarespartan commented 5 years ago

trying to repro but I don't get any errors or freeze. In the IB4m docs folder there is example which I am using as reference. Does this example work for you? Or are you requesting open orders some other way, etc? Just trying to figure out what the difference could be.

Despair2000 commented 5 years ago

This is funny. Let me compare the example code and mine...

Despair2000 commented 5 years ago

I found the difference that is causing the freeze.

I inserted in your example code the following:

while buf.isEmpty pause(0.5) end

When there are no open orders the buffer remains empty after the request is submitted and execution gets trapped in the while loop. I don't remember why I inserted the code in the first place. I fixed the problem now. Now it "gives up waiting" after 3s.

Thanks for pointing this out!