I'm wondering if there is anyone here who is using JAVA API to trade with Interactive brokers. I recently got the API and I'm trying to connect to the TWS through API. Unfortunately, I get the following error message -1 | 502 | Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu. I've enabled the AxtiveX and Socket clients and I'm still getting this. I'm wondering if anyone else experienced this in the beginning. Thanks in advance for any help/comments.
Yes, I use Java with IB. As I recall, it takes a little fussing to get it configured, but not a big deal. Biggest pain in the ass is that it shuts down once a day and requires a pin code to be keyed in. Silly.
Check the IP and socket you are using in your software and/or your firewall. This group is good to use for TWS API users. http://finance.groups.yahoo.com/group/TWSAPI/messages cheers
For two open source Java ATS for the IB API take a look at JSystemTrader http://code.google.com/p/jsystemtrader/ and JBookTrader http://code.google.com/p/jbooktrader/. Plenty of good code and functionality there (thanks to nonlinear5).
Thanks a lot for your response guys jeb999 :- from what I see, its an automated trading system. Do you use the Jsystemtrader? Does it have code to connect the IB's API? SInce I couldn't find it and I was wondering if you can direct me to the file i.e. the file name. I'm wondering if you use the "jsystemtrader" and "jbooktrader" and what has your experience been with them? dloyer :- Do you remember seeing this error? Also, I haven't connected yet so I wouldn't know about the system being reconnected once a day. I guess I'm still stuck at the very beginning and still trying to connect. Did you change any of the code in Java API code provided by IB?