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

Where can I find installation of IB Gateway 86x for linux under 974? #140

Closed tal952 closed 3 years ago

tal952 commented 3 years ago

I want to use ibc to make my gateway stay online all the time but I can't find anywhere IB Gateway 86x for linux under 974. Can someone help?

rlktradewright commented 3 years ago

I helped someone else do exactly this recently, with TWS/Gateway version 972. I'll try to provide you with the details this evening (no time now). I don't have an installer for Linux, just a Windows installer, but in fact the .jar files that contain the code are identical for Linux, Windows and macOS, so it's really just a matter of getting those .jar files into the right place where IBC expects to find them.

However I strongly advise you against this: you should really learn to live with the current versions. Although 972 was the 'stable' version until relatively recently, the fact is it's no longer maintained by IB: so no bugs discovered in it are fixed, and it's quite possible that changes made elsewhere in IB's infrastructure will eventually cause it to malfunction. Also, I don't know whether I have the latest version of 972 that IB released, so there could be bugs in it that have actually been fixed but will still be in the version I can give you.

And in particular, IB will eventually stop it being used altogether, and then you'll have no choice but to move to a more current version. This could be next week, next month or years from now - there's no way of knowing, but you really should prepare for this inevitable event. Don't get caught out!...

More later.

tal952 commented 3 years ago

I have a special situation... I'm running on raspberry pi zero w. The latest gateway is not working on it, but version 974 does (After some modifications). It works find, but the auto restart feature is not working for some reason and I can't make it work. So I rather go to 972 if I can't update to the latest, And run with it until IB will block me. Thank you for the help!

rlktradewright commented 3 years ago

Ok, there are two aspects to getting this to work:

  1. The Java .jar files which contain the TWS and Gateway code: these are cross-platform, and should work on any system (Linux, Windows, macOS, ...). Normally these are put in a specific location by IB's TWS and Gateway installers, and that location differs between Linux, Windows and macOS. Also the location is different for TWS and Gateway, even though the .jar files are exactly the same whether you install TWS or Gateway (or both): the .jar files contain the code for both TWS and Gateway.

    The IBC scripts know about these locations (obviously), and are clever enough to run either TWS or Gateway even if the .jar files are only in one of the locations.

    So all we need to do here is to get the .jar files into one specific location, and then IBC can run either TWS or Gateway.

  2. The Java runtime: this of course is platform-specific, since it has to take account of differences in the operating system, word size, and a host of other things. The IB installers for TWS/Gateway automatically install the version of Java that was used to develop them, in a hidden location, so that the user doesn't have to install Java.

    So we have to ensure that the correct Java runtime is installed.

Java .jar files

I've put a zip file containing the relevant .jar files and other necessary items) here:

https://1drv.ms/u/s!AlqfLEOWDJ9Zh-JRAj6MeDaaUfeKPw?e=UIqBA9

Here's what you need to do:

  1. Extract the contents of the zip into your home folder ~.

  2. You should end up with these folders:

    ~/Jts/972 (containing file tws.vmoptions)

    ~/Jts/972/.install4j (containing file pref_jre.cfg)

    ~/Jts/972/jars (containing the Java .jar files)

  3. Edit the file ~/Jts/972/.install4j/pref_jre.cfg replacing XXXX with your Linux username

Java runtime

You say that Gateway 974 runs ok on the pi, so I presume you have previously installed it. This means that the Java runtime you need should already be in place, even if you have since uninstalled 974: this is because uninstalling Gateway or TWS doesn't seem to remove the Java runtime.

If in fact the Java runtime is somehow missing, the IBC scripts will give an appropriate error message when you run them. In this case, try installing any later version of Gateway, which will put it back again. You can uninstall it again straight away if you don't want to actually use it, and the Java runtime should remain in place.

All set!

You should now be able to run the IBC scripts successfully. So edit your gatewaystart.sh or twsstart.sh script to set the right version, ie TWS_MAJOR_VRSN=972, and let it rip!

tal952 commented 3 years ago

This is so cool, thank you very much! Super appreciate it!