-
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
WHATIF-order causes disconnect #143
Comments
@softwarespartan @abelatnvidia This problem is very hard to grab since it is hard to reproduce. One week ago (when I wrote the initial post) I was really plagued by it and my program exited countless times (surely 15-20 times). Friday I ran the exact same program again and it happened only once that the error occurred. So I assume it depends on what else is going on on the computer (especially java related). Would be awesome if you would find the time to have a look Abel! Thanks in advance! |
Apologies this was missed. Likely overdue for an IB API update. This is probably a bug in the API itself. I should have some time over next few weeks to refresh.
…-Abel
On Dec 12, 2021, at 3:00 AM, Despair2000 ***@***.***> wrote:
@softwarespartan <https://github.com/softwarespartan> @abelatnvidia <https://github.com/abelatnvidia>
This problem is very hard to grab since it is hard to reproduce. One week ago (when I wrote the initial post) I was really plagued by it and my program exited countless times (surely 15-20 times). Friday I ran the exact same program again and it happened only once that the error occurred. So I assume it depends on what else is going on on the computer (especially java related).
Would be awesome if you would find the time to have a look Abel!
Thanks in advance!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#143 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABC2VVGULO53XXQ2K4STGYDUQRJATANCNFSM5JLLHXCQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Now I got a new variation. God knows what caused it: 2 510 Request Market Data Sending Error - java.lang.NullpointerException And disconnected. I get it again and again. I'm just trying to request market data for an option. |
Happy new year @softwarespartan @abelatnvidia, Around new year IB send out emails and asked to upgrade to a newer version of TWS (or API?) because of some sort of vulnerability (you maybe also got this email). I was already worried that IB4m maybe won't work afterwards (I think to remember that 29th dec was the date) but so far it still works. On this note, have you been able to think a little bit about the update you named? The disconnections are still bugging me. |
I can add the following info. 1.) The error occurs also on the live account and not only on the paper account. |
@Despair2000 I have added latest IB-API updates to IB4m. You can try these updates out by adding the |
@Despair2000 p.s. apologies this took so long to get rolling, we just welcomed our new baby boy a few weeks ago so it has been a busy time :) |
Congratulations! My son just turned 1 so I know what you are talking about :-) I will test your update and come with feedback. |
I just tried a first time to connect with the new jar-file and got the following error: Unrecognized function or variable 'getEventWithRemove'. Error in TWS.processNotification (line 4) Error in connectIB (line 29) com.mathworks.jmi.MatlabException: Undefined function 'getEventWithRemove' for input arguments of type 'com.tws.Handler'. |
I now changed line 4 of the process notification to:
After doing this the above error doesn't show up but I can't connect anyway because I get the following error: -1 502 Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled and connection port is the same as "Socket Port" on the TWS "Edit->Global Configuration...->API->Settings" menu. Live Trading ports: TWS: 7496; IB Gateway: 4001. Simulated Trading ports for new installations of version 954.1 or newer: TWS: 7497; IB Gateway: 4002 I receive this although all the mentioned settings are correct and work fine with the TWS973.jar. I tried on two computers and it's the same on both. |
...or am I missing something here now? To use the new jar-file one just have to change it on the javaclasspath, right? Or are there some more changes I should have done? |
@Despair2000 can you check which version of Matlab and TWS you are using? My first few thoughts are that this update uses the bleeding edge IB API so might need most recent version of TWS. Typically, error 502 is a socket issue. I know the old JAR file works for you but, I would just double check/confirm that you are indeed connecting on a port that is valid for live trading, vs paper trading, vs gateway, etc. RE: |
I use Matlab 2021b and also the latest TWS (10.12.2j). I just tried again with the jar-file you uploaded and I get the same error. When you tell me to double check the ports and so on I don't really know what you mean. When I switch to the new jar-file the only think I change is the entry in the javaclasspass. The function I use to connect with the port and IP and the settings of the TWS I don't touch. P.S.: The"getEvent-error" is now gone with the new jar-file. |
I really tried everything I could imagine but I can not establish a connection with the new jar-file. I tried with the TWS and gateway (both live and paper), both on PC and MAC. :-( Can you login with the new jar-file? |
@softwarespartan I haven't made any progress here and have no idea how I can make the new jar-file work. :-( |
Apologies for delay! Is it possible to send a log file or any diagnostic info ? For example, even if TWS was not even open, would generate the same error.
… On Feb 19, 2022, at 5:01 AM, Despair2000 ***@***.***> wrote:
@softwarespartan I haven't made any progress here and have no idea how I can make the new jar-file work. :-(
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.
|
I was just thinking myself about activating the log-file. I have never used the log-file before and obviously I'm doing something wrong. I activated the API-logging in the global configuration of the TWS and as google tells me there should be created a log.txt in the installation directory of the TWS. Sadly this is not the case. There is a file called launcher.log but this seems to be only logging the login to the TWS. However the same error is thrown if the TWS isn't even running. So I'm not sure if there would be something in the log-file if I could find it :-/ So you can login with this jar-file? |
Now I found at least also the logs in the TWS. |
So I now tried again after I found the logs in the TWS and when I attempt to login with IB4m there isn't logged anything (almost). This is although I activated detailed logging. Obviously the log I posted yesterday showed a lot of other things that did not belong to my login attempt. ============================== Log file: /Users/boriskleine/Jts/milbcblkagmloocjldnbedbojialplcealbooiaf/api.0.20220220.100521.ibgzenc ============================= ============================== Log file: /Users/boriskleine/Jts/milbcblkagmloocjldnbedbojialplcealbooiaf/api.0.20220220.100549.ibgzenc ============================= |
I understand that you are busy with other issues. Just drop a line when we can investigated this issue further (I did not make any progress). I will so long keep on using the 973 jar-file. |
@softwarespartan |
@softwarespartan
Hi Abel,
I stumbled over a strange problem and think the problem might be within IB4m.
It happens me annoyingly often that directly after sending a WHATIF-order I get an error 511 or 512 "Oder Sending Error" - Java exception. And then I'm disconnected from the TWS. This happens more often when there are several API calls in a row but it also happened when there was no call before some time.
I think the full codes I saw were 249 512 (this I'm sure of) and 21 511 (not so sure on the 21).
I tried to look into this a little bit and found, "error codes 511 and 512 (and other 5xx codes) are used in the Java and C# APIs and are client side errors. In other words, they get raised locally in the client when an API request caused an exception. These error codes do not come from TWS.
(...) In any case, 5xx errors indicate that something happened when the client was writing bytes into the socket that it uses to communicate with TWS."
Maybe I should add that I used WHATIF-orders for some time on my live account without problems. It was now when I started a new project and tried it on the paper account that I ran into this problem.
Do you have anything smart to say to this problem? :-)
The text was updated successfully, but these errors were encountered: