Closed JohnShiuMK closed 3 years ago
Read the very first section in the User Guide.
As it happens, some time ago a member of the IBC User Group pointed out an approach, using the Java Agent API, that could enable TWS IBC to work with IBKR's auto-relogin mechanism (see https://groups.io/g/ibcalpha/message/1166). He also provided a sort of 'proof of concept' implementation to demonstrate its viability. However I haven't had the time to turn this into a robust implementation, and to be honest I don't currently feel much urgency in this, as users seem to be coping without it.
Nevertheless, I am interested in this approach and may be able to commit some effort to it eventually. I would also be happy for someone else to submit a pull request that implements this, but it must be well-engineered and thorough, and preserve all the existing IBC functionality (the proof-of-concept implementation referred to above didn't meet these criteria).
I'm not sure whether I am capable to help.
All I noticed is the IBC automates the TWS / IB Gateway based on this: "~/.i4j_jres/1.8.0_152-tzdata2019c_64/bin/java"
Is that ".../java" the same or something similar to the Java Agent?
I wasn't specifically inviting you to do this work - it was a generic invitation to anyone who follows this repository, and who feels they might be able to do it. to have a go.
From what you say, it doesn't sound like you'd be a likely candidate, but that's just fine: it's perfectly OK to just be a user and not feel a pressure to contribute something.
Thanks.
I'm thinking whether it's possible, through changing some part of the codes, that the IBC will only do the following: 1) open the tws / ibgateway console from the ~/Jts/.../ibgateway (instead of opening it from "java -cp ... ibcalpha.ibc.IbcGateway") 2) (if ibgateway) click "IB API" 3) (if paper trading) click "paper trading" 4) fill in the username and password from the config.ini 5) click login
In this case, I may be making it as a docker image and schedule the docker run / docker-compose up, down via the crontab.
What do you think?
I think the above approach is another solution to:
What I think is that you perhaps don't have a clear understanding of how IBC actually works. It sounds like you think that IBC and TWS/Gateway are separate processes, and that the IBC process somehow magically controls the TWS/Gateway process.
But that is altogether the wrong picture. IBC and TWS/Gateway have to be running in the same process so that IBC can register itself as an AWT event listener. To do this, IBC starts first, registers as an AWT event listener, and then loads TWS/Gateway into the same process so that it receives events such as the login dialog being displayed: then it can insert the username and password and click the login button. A separate process cannot do this in Java. (Note that a separate process written in say C++ or C# can do this by handling operating system events, but not a process written in Java (unless it makes heavy use of the JNI API, but then the code becomes non-portable).
The approach of using the Java Agent API is that it effectively enables IBC to be 'injected' into the TWS/Gateway Java process, and in that case it doesn't matter how that Java process is started, and it doesn't matter which 'edition' of TWS/Gateway (ie standalone or self-updating) is used to start it. Once IBC is running in the process, it can register as an AWT event listener in the usual way, and carry on as normal.
It's not very difficult to do this injection process, as the proof-of-concept implementation I referred to earlier showed. But the problem with that implementation was that it also changed and even removed parts of the IBC code that the author, I assume, didn't understand the reason for being there, so it wasn't acceptable as it stood, and as I said before I simply haven't had any time to work on it myself.
So, if you're interested in taking this forward, can I suggest you first get a clear picture of how IBC works. I don't want to spend my time discussing non-viable suggestions.
Hi,
Thanks for inventing and maintaining the IBC, it's very convenient.
I'm using the IB gateway (Build 978 / 981). Recently, I find that there should be the "Auto logoff" / "Auto restart" options in the "Configure > Settings > Lock and Exit". (The "Auto restart" can actually prevent us from re-login with 2FA for a week)
Those options exist when I open the gateway manually in the Jts/, i.e. without using IBC, but they disappear when I open it with the IBC. (IBC version: 3.8.4-beta.2)
Is it a known thing/issue? If it is an issue, is it something to be fixed soon?
Best, John