softwarespartan / IB4m

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

Is there a way to get reqId associated with error message? #79

Closed ecpgieicg closed 4 years ago

ecpgieicg commented 4 years ago

Hi Abel,

Is there a way to get reqId associated with the error messages returned by IB server in the error buffer?

I currently do something to the effect of:

[bufe,lhe] = TWS.initBufferForEvent(TWS.Events.ERROR);
any(regexp(char(bufe.remove.data.toString),[num2str(reqId),' '])==1),

Even though IB shows reqId in the string, I just want avoid the risk of having a randomly reqId coinciding with some number in the other part of the error message.

softwarespartan commented 4 years ago

It would be great if it were possible. The error call in the API returns id, errorCode, and msg which are all included in the IB4M response. Not sure that the id is a request id. In the docs, IB refers to this id as "error id"

https://interactivebrokers.github.io/tws-api/error_handling.html

softwarespartan commented 4 years ago

@ecpgieicg let me know if need anything additional here