Part 4 · Your platform, step by step · 4.8

Interactive Brokers bridge

Live ES and NQ prices in the terminal from your own TWS or IB Gateway: enable the API in TWS, run start.bat, connect.

The IB bridge brings the prices of your Interactive Brokers account into the TLADe terminal: 5-minute candles streamed live with their real volume, two weeks of history and one year of daily bars. Everything runs on your computer, on localhost:5000. It needs no API key and nothing to configure in the terminal: the terminal finds it by itself.

You need an Interactive Brokers account (live or paper), TWS or IB Gateway running, and Python 3 installed.

#1. Enable the API in TWS

TWS: Global Configuration, API, Settings.
File → Global Configuration → API → Settings

In TWS, File → Global Configuration:

  1. API → Settings.
  2. Tick Enable ActiveX and Socket Clients.
  3. Socket port: 7496 for a live account, 7497 for a paper account.

Keep Allow connections from localhost only ticked. Click Apply, then OK, and restart TWS if it asks.

#2. Install Python, once

If you do not have it yet, download Python 3 from python.org. On the first screen of the installer tick Add Python to PATH, then Install Now.

#3. Start the bridge

Download the bridge from the terminal (Menu → Indicators & Data Feed → Data Feed Bridge → Interactive Brokers) and unzip it. Double-click start.bat (on a Mac, start.command). If Windows says "Windows protected your PC", click More info → Run anyway.

The first launch of start.bat.
The first launch.
  1. The first time, the bridge checks Python, installs what it needs, and asks two questions:

- the TWS API port: press Enter for 7496, or type 7497 for a paper account; - the Client ID: press Enter for 10. Change it only if another program already connects to TWS with that number.

It saves the answers, and next time it only asks whether to use them again.

The bridge running.
The bridge is running and the terminal is reading it.

When it is running, the window shows the terminal asking for the data. Leave this window open while you trade: closing it stops the bridge. You can minimise it.

#4. Connect the terminal

The terminal detects the IB bridge.
The terminal finds the bridge by itself.

Open (or reload) the terminal: it finds the bridge and asks whether to connect. Choose how often it updates (3s is the recommended setting) and click:

  1. Connect.

At the top, under the price, the terminal now says IB LIVE.

#If something does not work

  • Python is not recognized: Python is not in the PATH. Run the Python installer again with Add Python to PATH ticked.
  • Address already in use on port 5000: another program is using port 5000, often another bridge already running. Close it, then start this one.
  • The bridge cannot connect to TWS: check that TWS is open, that the API is enabled as in step 1, and that the port is the right one (7496 live, 7497 paper).
  • Error 326: the Client ID is already in use by another program. Start the bridge again, answer n to Use these settings?, and choose another number.
  • The terminal never switches to live (Chrome): Chrome may block the page from reaching your own computer. Open chrome://flags/#local-network-access-check, set it to Disabled and restart Chrome. Firefox does not have this block.