DEV Community

FMZQuant
FMZQuant

Posted on

Instructions for Installing Interactive Brokers IB Gateway in Linux Bash

FMZ platform now supports the integration of Interactive Brokers (IB). It's quite simple on Windows, so we won't explain how to install it here. For Linux users who generally rent servers without a graphical interface and only have SSH, the installation is more challenging. This article will explain how to install IB Gateway for quantitative trading. We usually choose to install IB Gateway instead of TWS client, because the TWS client shuts down periodically and is not suitable for quantitative trading. Here we take Debian as an example:

Step 1: Install Desktop Services and VNC

First, you need to install desktop services and a VNC server to enable remote desktop access. Here, we will use xfce and TightVNC as examples. Execute the following commands in the terminal to install:

sudo apt update
sudo apt install xfce4 xfce4-goodies dbus-x11
sudo apt install tightvncserver
tightvncserver
Enter fullscreen mode Exit fullscreen mode

Please note that the maximum length for the password during installation is 8 characters. Please set a highly secure password. The default startup port for the first session is 5901.

Step 2: Connect to VNC and Install IB Gateway

The default address is vnc://IP Address:5901, you can log in by entering the password. For Windows, please download and install the VNC client yourself.

Download page: https://www.interactivebrokers.com/en/trading/ibgateway-stable.php
Please use a tool similar to wget for downloading. If you can't find the corresponding version, please click on "Download for Other Operating Systems" on the page to search.

wget https://download2.interactivebrokers.com/installers/ibgateway/stable-standalone/ibgateway-stable-standalone-linux-x64.sh
Enter fullscreen mode Exit fullscreen mode

If it's inconvenient to download within VNC, you can initiate a separate SSH download and then install it under the VNC desktop environment.

bash ibgateway-stable-standalone-linux-x64.sh
Enter fullscreen mode Exit fullscreen mode

The interface can already be displayed here, you can manually run the installation directory directly by running ./ibgateway.

Image description

After installation, log in and find the API option. Make sure to uncheck "Read-Only API". The port number is also in the settings. Please configure the exchange correctly according to this port number.

Image description

The exchange is configured as follows: Client ID. If you have multiple robots that need to connect, this needs to be set to different IDs, as IB does not allow the same Client ID to connect simultaneously.

Image description

It should be noted that localhost and 127.0.0.1 are not the same network address at the lower level of the Linux operating system, here we use localhost.

IB's market data requires a paid subscription. If you need real-time ticker and depth information, please subscribe for a fee, otherwise you can only receive delayed tickers.

From: https://blog.mathquant.com/2023/12/04/instructions-for-installing-interactive-brokers-ib-gateway-in-linux-bash.html

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay