IbcAlpha / IBC

Automation of Interactive Brokers TWS. You can download the latest release here: https://github.com/ibcalpha/ibc/releases/latest
GNU General Public License v3.0
1.03k stars 181 forks source link

Question: Is there any difference on launching TWS with IBC while using an ibgateway installation #239

Closed gnzsnz closed 8 months ago

gnzsnz commented 10 months ago

I've been using IBC with ibgateway for some time, always using -g parameter on script ibcstart.sh.

Recently i realized that if I remove IBC's -g parameter it will actually launch TWS even though I installed ibgateway and not TWS.

So my question is, is there any problem with this approach? is there any missing dependences, or consequence of runnint TWS in this way.

I find it very convenient, as with a single installation I can have both for the price of one. But i wonder if there is any known limitation on this approach.

rlktradewright commented 10 months ago

This is explained in the User Guide, so you are only stating what is already described there. It has always been the case that you only need to install one or the other to use both.

The Java .jar files installed by the TWS and Gateway installers are identical. What's more, they're the same on all platforms. The only thing that's different is the top-level program (on Windows) or script (on Linux/macOS), and IBC doesn't use those. The IBC script finds whatever version you've got installed, and it uses the value of the -g parameter to determine which entry point to use.

gnzsnz commented 10 months ago

Thanks, I missed that part on the use guide. I just went through it.

Based on the user guide and your comment above, there's no difference between ibgateway and tws so there shouldn't be any surprise by running tws from an ibgateway installation and vice versa.

I found that tws needs libnspr4 libnss3 ( on Linux) as it runs a Java web browser, but after installing these dependencies a haven't seen any other problems on the logs.

Thanks for the confirmation.

rlktradewright commented 10 months ago

I don't have any problem running TWS/Gateway on Linux without installing additional libraries.

Are you perhaps setting the --java-path parameter to ibcstart.sh? If so that's probably the cause of the problem. You need a good reason for setting this: the default uses the 'private' Java installation included by the TWS/Gateway installers. It contains everything you need, and is the version against which IB have developed and tested their software, so it's best to use this: it also means you don't have to install Java yourself.

To be frank, you really shouldn't be using ibcstart.sh directly yourself. Just use the top-level IBC scripts (twsstart.sh and gatewaystart.sh) and everything will be fine.

gnzsnz commented 10 months ago

I never had any problem with TWS. I only had problems when i used an ibgateway to launch TWS, i thought that it was because it was not supposed to work that way. But you have clarified that.

The thing is that i'm launching TWS from a minimal ibgateway instalation, a container. and I'm facing some issues. the logs complained about missing libnspr4 libnss3, so i installed, and things got better. and found this list of dependencies for JxBrowser https://jxbrowser-support.teamdev.com/docs/tutorials/integration/docker.html, which i installed and things got even better.

So basically you confirmed that my issues are coming from my minimal installation and not from ibgateway installer. which has put me on the right direction.

Thanks for your help

rlktradewright commented 10 months ago

Ok.

I suspect IB expect their users to be installing in a standard desktop environment, which already contains these dependencies.

Indeed, some months ago I installed a minimal Ubuntu Server just a for a bit of fun (which it wasn't!), and hit the same dependency problem. I eventually got it working, using xvfb and RealVNC to get a UI, and it ran just fine, fully automated, for a week or so, but then I reverted bak to Windows because I'm just not confident managing such a setup for the long term.

gnzsnz commented 10 months ago

I have it working with linuxserver rdesktop image https://github.com/gnzsnz/ib-gateway-docker/blob/master/tws-docker-compose.yml

I'm testing it, as there are still room for improvement. it's operational at the moment, but with some hiccups here and there