Interactive Brokers Configuration

Part 1) Interactive Broker account and Trader Workstation setup requirements (Account type, datafeed subscription and symbol limitation)

IBKR account Type

You can use Investor/RT with an IBKR Pro real-money account or with a paper account associated with this IBKR Pro real-money account and sharing the same data feed subscription. You can not connect with an IBKR Lite account, as it doesn't support any API connection.

TWS and Investor/RT software installation

You must run Interactive Brokers Trader Workstation (TWS) on the same PC as Investor/RT, and connect TWS first to your IBKR account before starting Investor/RT. TWS needs to remain connected to your IBKR account while using Investor/RT
eminder: TWS forces you to disconnect from your IBKR account once a day

Connecting simultaneously multiple Investor/RT instances (or other 3rd party applications) to your IBKR account

A single instance of TWS can support up to 8 simultaneous API client connections. You can connect multiple instances of Investor/RT (installed on the same PC) to your TWS account. In this case, inside the Investor/RT TWS connection settings (discussed below), a different Client ID needs to be used for each Investor/RT instance

Data feed subscription & specific API symbol limitation 

Always ensure that you have subscribed to the correct real-time exchange data feed on your TWS account. IBKR can be tricky:  seeing live quotes for a specific market on a TWS watchlist doesn't always mean that the corresponding data are available through their API (without paying the corresponding exchange data fee). Please note that :

  • TWS API do not support the streaming of any delayed data to third party software.
  • TWS does impose a limit on the number of active tickers. If you have more than 100 active tickers, then IB will cut off data for excess symbols. This is a global limitation to be evaluated between TWS and any connected 3rd party sotware.. If a TWS Watchlist is displaying 50 symbols, and the Investor/RT API connection is retrieving 25 market data lines, this means that an additional 25 market data lines are still available. If needed, "Quote Booster package" can be purchased from IBKR (to increase this 100 max. limit)
  • Investor/RT only supports Level 1 data streaming from IBKR. As discussed in section 3.2), you could access level 2 data to trade futures with your IBKR account under a mixed IQFeed / IBKR configuration.

Part 2) TraderWorkStation API configuration settings

Access the TWS API settings through the menu  File > Global Configuration on the Interactive Brokers TWS software and adjust, if needed, the status of the following settings

  • Enable the “Enable ActiveX and Socket Clients” option.
  • Make sure the checkbox for "Read-Only API" is NOT checked.
  • Set the Socket Port to 7497 (IB paper account) or to 7496 (real money account)
  • Check “Allow connections from localhost only” 
  • In the  API > Precautions menu, enable “Bypass Order Precautions for API Orders”.
  • Press OK to save the IBKR API settings.

Here is how the TWS API Settings page should look:

Part 3 – Investor/RT configuration for IBKR datafeed 

3.1) Initial Investor/RT set up and selecting Interactive Brokers as your main source of live data

If you haven't yet run Investor/RT,  download the latest 16 version, make sure to right click on the file and select Run As Administrator.

Open Investor/RT : Use the Investor/RT Setup wizard (or go to Data > Configure Data Source and Broker if you already have used Investor/RT with another data source).

Select one of the 2 IBKR connection methods and let Investor/RT restart

As per the above screenshot, Investor/RT 16 and higher offers 2 ways to use IB as a live datafeed

  • The "Interactive Brokers Legacy" connection method, based on an older TWS API version. If you have a current user of this IB legacy connection method under I/RT 15, and use it so far satisfactorily, you may continue to do so under I/RT 16
  • The newest "Interactive Brokers API" connection method has been introduced with I/RT 16 beta release in order to ensure perfect connectivity when it comes to order execution and "live" position communication (which could not be guaranteed anymore with the previous IB connection method)

In both cases, it is strongly recommended to use Linn Software DTN MA service for any data backfill request. This is a requirement for the newest IB API connection method as it does not currently support any data download from IB servers, but is only designed to get live data from IBKR and use DTNMA for any historical data backfills

The next setup step will be the input of the Investor/RT TWS API settings (under the menu "Data > Setup IB")

  • Select "localhost" as TWS IP Address
  • Select as Port 7497 (IB paper account) or 7496 (IB live account)
  • Input your TWS account (typically DUxxxxxxx for a paper account or Uxxxxxxx for a live account)
  • TWS Client ID : keep 0 or random ID (if connecting a single Investor/RT Instance to TWS) or select a specific ID if multiple I/RT instances (or applications) are connected to your TWS account

Note: your DTN MA subscription ID will automatically appear 

Make sure TWS is already running prior to connecting Investor/RT

3.2) Investor/RT set up with IQ feed as main live data source and Interactive Brokers as brokerage destination

Under the "Configure data source/broker" menu, select "Subscription Source", DTN IQ feed and then select "IBAPI" and brokerage destination.

Investor/RT will then restart and you will be able to fill the IQ and IB setup with the menu Data > Setup IQFeed/IBAPI (same instructions as above for the TWS settings).

Before starting both data connections (IQFeed and IB) simultaneously through the Data > Start Data menu, make sure TWS has already started.  

Please note that only the newest IB API connection is now offered (in Investor/RT 16.1 and higher) as order execution option when used in conjunction with IQ feed.
To use Futures Level 2 data stream from your IQ feed subscription, make sure the configuration variable “UseBrokerDepth” is set to false (the default value,true, is the one most commonly applied when executing orders towards CQG or Rithmic, and reusing the associated level 2 data)

3.3) Connection confirmation

The active/inactive status of an Interactive (either in direct mode or when using IQ feed as main data feed) can be checked through the usual "Data > Data Source Status" menu from the main toolbar

In the case of a dual IQfeed / IB API connection, corresponding menu should clearly indicate that both connections are active

Part 4) Investor/RT Instrument setup and symbol guide for IBKR

Instrument setup is a bit different from the other brokerage data source (CQG, Rithmic). 

For identifying a Futures contract, Interactive Brokers doesn't rely on the sole instrument symbol, but also requires that 5 pieces of information are perfectly matching the internal IBKR symbol definition settings (as visible in the TWS symbol search tools)

  • The "underlying" code of the future contract (referred as the IBKR "Root Symbol" within Investor/RT terminology)
  • The exchange name (this input should perfectly match the IBKR exchange name)
  • The currency of the future contract
  • The actual expiration month of the future contract. (Be careful here: this is the actual month of the expiration date of the contract, not the future contract month as indicated by its usual Letter).
  • The "multiplier" attached to the IBKR contract definition (if any). indeed, in some cases (highlighted in our symbol guide), IBKR uses the same root symbol for both a full and micro (or mini) contract and relies on a multiplier to identify one of these contracts. The principal consequence of this approach is that any third-party trading application (connecting to IBKR through its API) is only able to connect simultaneously to a single contract among those identified by a multiplier. The main concerned contracts are Eurostoxx 50 (Full and Mini contracts), DAX (Full, Mini and Micro contracts), COMEX Silver futures (Full and Micro contracts) and, since recently, the CME E-Mini Nikkei contracts (Full and Micro contracts)

Please refer to the IBKR symbol guide page that details the possible adjustment you might needed to do

95% of the time, the Instrument Setup will be simple; ie 

  1. Open Investor/RT and go to File > Open > Quotepage. Double click on the .AllSymbols Quotepage from the Object Manager.
  2. Place your cursor into any ticker column cell and press Enter to open a new row. Type in the Interactive Brokers symbol and press Enter (optionally, type another and then Enter, etc).

But, as discussed in detail in the symbol page, in some specific cases, you might need to make some adjustments to make sure that the fields, marked in red, are matching the description window in TWS

Part 5) Order execution with the newest "IB API connection"

The trading with Investor/RT support page offers an introduction to the main Investor/RT trading and order execution main features. All the usual way to intorduce orders manually (through trading order button, the DOM, mouse cliks on a charts) or automatically (through a Signal Action, the Trading Rule or Trading system Indicator) are  

Please note that native OCO orders from IBKR are currently supported.

Here are recently introduced features (in Investor/RT 16) to optimize the trading of stocks under an IQ feed / IBKR configuration

  1. IQ Feed: new filtering method for outlier stock trades during the Nasdaq extended session

    Several improvements have been implemented to remove pre- and post-market outliers (aka “out of sequence” trades) and get clean tick-by-tick data for stock data being received from IQ Feed.
    This is achieved through the new configuration variable ExtendedTradePriceFilter. For DTN IQFeed and DTN Historical users, ExtendedTradePriceFilter is a filter value in cents; if the extended hours trade price exceeds ExtendedTradePriceFilter cents outside the bid/ask range, the trade will be ignored.
    Note : The Issue with the DTNIQFilterOutOddLots configuration variable not working properly outside of cash session hours was fixed

  2. IBKR: improved management of Limit Orders during ETH periods

    The management of limit orders during the Nasdaq pre- and post-market periods has been improved. The good execution of such orders required 2 separate settings to be activated :
    On the IRT side, the configuration variable IBTradingOrdersRthOnly needs to be set to false if you want to allow IB trading orders to be executed outside of regular trading hours.
    On the TWS side, on the Configuration > Presets > Stocks menu, the “Allow order to be activated, triggered, or filled outside of RTH” box needs to be checked

  3. Trading from the chart: new method for adjusting the size of working orders

    The ability to easily modify the quantity of resting orders on the fly (by right-clicking the existing working order ref line) has been improved. This is achieved through a new configuration variable, TradingQtyIncrementEquities, which specifies the preferred number of shares to increment or decrement a working order quantity for equities in the ChartTradingDOM or when using a chart's Working Order Reference Line.

Please note that trading Nasdaq stocks is best achieved with Investor/RT under an IQFeed / IBKR configuration. You have access to a true tick by tick datafeed and can fully enjoy all Volume profile, Cumulative delta, Footprint and Order flows tools of the Investor/RT package.