Interactive Brokers: Gateway Install & Setup

A brief tutorial on setting up the Interactive Brokers Gateway on Linux.

I’m working on a project that uses data acquired from the Interactive Brokers API. The API is not accessible directly but rather via a local client which is installed on your machine. You have two options for this client:

  • Interactive Brokers Trader Workstation (TWS) and
  • Interactive Brokers Gateway.

The former provides a fully featured trading interface, while the latter simply provides and interface to the API. I’m going with the latter.

Download

Download the Gateway installer. There are two versions: stable and latest.

IBDOWNLOAD=https://download.interactivebrokers.com/installers/ibgateway
# Stable version
curl -o ibgateway-standalone-linux-x64.sh $IBDOWNLOAD/stable-standalone/ibgateway-stable-standalone-linux-x64.sh
# Latest version
curl -o ibgateway-standalone-linux-x64.sh $IBDOWNLOAD/latest-standalone/ibgateway-latest-standalone-linux-x64.sh

Install

Next you need to run the installer.

chmod u+x ibgateway-standalone-linux-x64.sh
./ibgateway-standalone-linux-x64.sh

You can safely accept all of the defaults in the installation process.

The Interactive Brokers Gateway installation wizard.

Launch

During the installation a Jts directory will be created. Beneath that you’ll find a sub-directory named with the version of the gateway (for example, 1015) and within that you’ll find the executable, ibgateway. Run the executable.

Choose the IB API option for API type. Fill in your username and password. Press the Log In button.

Interactive Brokers Gateway login dialog.

From time to time you’ll find that you are unable to login because the servers are down for maintenance. Just be patient and the service will be restored. Maintenance seems to typically occur around midnight UTC on a Friday night, but this seems to vary.

Interactive Brokers Gateway login dialog with notice about scheduled maintenance.

Once connected you should see an interface showing the connection status.

The Interactive Brokers API Gateway.

Conclusion

Once the Gateway is running and you’re connected you’ll immediately be able to interact with the API. You can do this from a variety of languages. Unless timing is hyper-critical for what you’re doing then I’d suggest exploring either the Python or R interface to the API.

Resources