Interactive Brokers: Gateway Install & Setup

datawookie blog

Contributor:
datawookie blog
Visit: datawookie blog

By:

Data Scientist

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.

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.

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.

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

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

Visit datawookie blog for additional insight on this topic: https://datawookie.dev/blog/2022/04/setting-up-interactive-brokers-gateway/.

Disclosure: Interactive Brokers

Information posted on IBKR Traders’ Insight that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Traders’ Insight are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from datawookie blog and is being posted with permission from datawookie blog. The views expressed in this material are solely those of the author and/or datawookie blog and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

In accordance with EU regulation: The statements in this document shall not be considered as an objective or independent explanation of the matters. Please note that this document (a) has not been prepared in accordance with legal requirements designed to promote the independence of investment research, and (b) is not subject to any prohibition on dealing ahead of the dissemination or publication of investment research.

Any trading symbols displayed are for illustrative purposes only and are not intended to portray recommendations.

Disclosure: API Examples Discussed

Throughout the lesson, please keep in mind that the examples discussed are purely for technical demonstration purposes, and do not constitute trading advice. Also, it is important to remember that placing trades in a paper account is recommended before any live trading.