Running IB Gateway on a VPS

25 Jun 2014

Running IB Gateway and your trading app on your home desktop or laptop may be convenient but not proof against disruptions in
internet connectivity, power supply or hardware failures. Having IB Gateway run on an infrastructure of a reputable hosting
company is much more reliable. This cannot be underestimated when it comes to putting your money on the line. The following
tutorial shows how to install IB Gateway on a virtual server with Ubuntu 14.04.

A VPS instance usually comes with root user access and the following snippets assume running commands under root account.
If you are logged in as a different user but have superuser access via sudo then run sudo su - to get root shell.

Create directories for IB Gateways. One gateway will run with simulation account and the other one with real trading account.

mkdir -p /algoeye/sim/gw
mkdir -p /algoeye/real/gw
cd /algoeye

Java

Install Java. If you already have java installed then you can skip this step but make sure you modify all JAVA_HOME variables in below scripts.

VNC

IB Gateway is an interactive application not designed to be run on a headless server. As a workaround we will install VNC server
and use it to emulate graphical display. You will be able to connect to your server using VNC client and control IB Gateways,
change settings, etc.

The script which starts and stops VNC can be installed as init script or run from process monitor like Monit.
Save the following script into /algoeye/vnc.sh and make it executable with chmod +x /algoeye/vnc.sh

Check if vnc has been installed correctly by executing ./vnc.sh start. You should see process Xtightvnc running.

Gateway

Next step is to download and install IB Gateway and IBController. IBController is a nice utility used to automatically
start and log in to your account. Check out https://github.com/ib-controller/ib-controller if you'd like to know more about IBController.

AlgoEye automates execution of complex multi-instrument strategies, volatility surface fitting, identification and hedging of delta, gamma and vega risks.
AlgoEye is built for professional derivatives traders. More »