-
Notifications
You must be signed in to change notification settings - Fork 21
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
session.eClientSocket.reqPositions() causes java.lang.NullPointerException #15
Comments
Thanks for reaching out.
hm … that’s strange. It might be mis-match with the API version and the TWS version. Sometimes they update TWS and it sends some new/updated format and the API tries to grab some value from the tws data stream and it’s not there in the updated version. Maybe, i am just guessing at the moment. Usually these are easy fixes but we’ll see.
I am traveling but will try to look at this over the weekend and get back to you.
Cheers
-abel
… On Nov 24, 2017, at 6:15 PM, dani-alvez ***@***.***> wrote:
thanks for sharing your code, looks very useful!
when I run session.eClientSocket.reqPositions() to get open positions without having done any trade, I get a java.lang.NullPointerException and the connection to TWS will be closed.
When I have an open position or previously had them, then there won't be any error. Also when I restart TWS or Matlab, still there will be no error. It looks like after the night when the daily trades had been cleared, the error appears again.
Can you reproduce this? Is there any fix for that? Thanks for your help.
BTW, I'm running your latest version of IB4m, Matlab 2017a and TWS 962.2c with API 9.71.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#15>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1Ecf7cSlWS_tuGHQu75ADIoEb565ks5s504BgaJpZM4QqO40>.
|
Just as a data point ...
I am using TWS 969.0v Nov 22, 2017 with API 9.71 and no issues getting positions when i called it just now.
Looks like, from what you’re saying, only issue when there are no positions and get positions is called (i.e. null pointer from empty list).
Does that sound about correct?
If that is the case, might have to wait until monday so I can clear out paper account and test with zero positions active.
Thanks
-abel
… On Nov 24, 2017, at 6:15 PM, dani-alvez ***@***.***> wrote:
thanks for sharing your code, looks very useful!
when I run session.eClientSocket.reqPositions() to get open positions without having done any trade, I get a java.lang.NullPointerException and the connection to TWS will be closed.
When I have an open position or previously had them, then there won't be any error. Also when I restart TWS or Matlab, still there will be no error. It looks like after the night when the daily trades had been cleared, the error appears again.
Can you reproduce this? Is there any fix for that? Thanks for your help.
BTW, I'm running your latest version of IB4m, Matlab 2017a and TWS 962.2c with API 9.71.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#15>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1Ecf7cSlWS_tuGHQu75ADIoEb565ks5s504BgaJpZM4QqO40>.
|
dear Abel,
thanks, dan |
dear Abel, |
Hi Dan
Apologies, this has totally slipped my mind (!!)
I think both of email inquiries have been after trading for the week.
Will look into this over the weekend and test on Monday when I can clear out paper account.
Again, apologies for delay. We will get this sorted.
Happy Holidays
…-abel
On Dec 15, 2017, at 6:40 PM, dani-alvez ***@***.***> wrote:
dear Abel,
any news on this issue?
thanks
dan
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#15 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1GPltlnWdgkLvPK4GXTwGyj6XAS5ks5tAwOAgaJpZM4QqO40>.
|
Hi Dan
Looking through the IB API, nothing stands out as throwing the null pointer exception. However, since the connection gets closed, that means proly the API tried to read data off the socket for position that didn’t exist and threw an exception. Still doesn’t explain why the callback is fired in the IB API in the first place though. It looks like TWS automatically pushed a round of position updates upon initial API request. This way can get positions when markets are closed and position updates sent when positions change.
At any rate, will have to wait until the markets open tomorrow and try to find some time to step through the code to try to repro the situation.
Thanks
-abel
… On Dec 15, 2017, at 6:40 PM, dani-alvez ***@***.***> wrote:
dear Abel,
any news on this issue?
thanks
dan
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#15 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1GPltlnWdgkLvPK4GXTwGyj6XAS5ks5tAwOAgaJpZM4QqO40>.
|
Hi Dan
I have pushed update to GitHub which resolves this issue.
Currently, the behavior is not to return a response for empty positions (i.e. no event published for no events provided by TWS).
However, there is a good argument for actually returning an empty set depending on your software architecture convictions.
Either way, let me know if you need anything additional on this or encounter another bug.
Happy Holidays
Cheers
-abel
… On Dec 15, 2017, at 6:40 PM, dani-alvez ***@***.***> wrote:
dear Abel,
any news on this issue?
thanks
dan
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#15 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEWq1GPltlnWdgkLvPK4GXTwGyj6XAS5ks5tAwOAgaJpZM4QqO40>.
|
Dear Abel, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks for sharing your code, looks very useful!
when I run session.eClientSocket.reqPositions() to get open positions without having done any trade, I get a java.lang.NullPointerException and the connection to TWS will be closed.
When I have an open position or previously had them, then there won't be any error. Also when I restart TWS or Matlab, still there will be no error. It looks like after the night when the daily trades had been cleared, the error appears again.
Can you reproduce this? Is there any fix for that? Thanks for your help.
BTW, I'm running your latest version of IB4m, Matlab 2017a and TWS 962.2c with API 9.71.
The text was updated successfully, but these errors were encountered: