Interactive Brokers
Interactive Brokers broker connection
$49.95 / Lifetime OR included in Premium subscription
Try before you Buy! Download the Extension for a 14-day free trial before purchasing.
(all Extensions require a Wealth-Lab Subscription)

Interactive Brokers

Interactive Brokers live trading and data interface

  • Connect to IB TWS or the IB Gateway
  • Automated strategy trading
  • Order types: Market, Limit, Stop, StopLimit, Market On Close, and Limit On Close
  • Historical and Streaming data using your IB Data Subscriptions for quotes, charts, and Strategy Monitor

Requirements

One-Time Setup Instructions

It's required that you are logged in and running IB TWS or the IB Gateway to connect with IB. To make the connection you must perform this one-time setup:

Step 1 - Configure IB TWS
When logging in and before entering you credentials, select More Options > at bottom of the login dialog.
Specify a Time Zone that matches your Windows time zone.
Continue to log in to TWS and enable the following settings in the TWS Configuration > API > Settings:

  • Enable ActiveX and Socket Clients - checked
  • Socket Port - default is 7496. You only need to change this number for additional instances of TWS. WealthLab will connect to only one instance at a time.
  • Use Account Groups with Allocation Methods - unchecked (if you have multiple linked accounts).
  • Send market data in lots for US stocks for dual-mode API clients - checked (correct historical volume for stocks).
  • Allow conections from localhost only - to connect to TWS running on a different virtual machine or network uncheck this and enter the Trusted IP. For example, if you're using the Mac version of TWS, open your Mac's Network app and enter the IP for the wireless/cabled connection here, e.g., 192.168.1.10.
  • Send instrument-specific attributes for dual-mode API client in operator timezone.

Optional setting in TWS Configuration > API > Precautions

  • Bypass Order Precautions for API Orders - check this option if you don't want orders from WealthLab to be delayed or canceled due to exceeding a size limit or another precaution.

Step 2 - Configure Interactive Brokers in WealthLab
Configure the WealthLab connection settings for IB in the Data Manager > Historical (or Streaming) Provider tab or use the Order Manager > Interactive Brokers > Configure. Specify the following:

  • Host IP Address - default: 127.0.0.1. Alternatively, enter the IP address you configured in TWS if not the localhost.
  • Port - default: 7496. Use the Socket Port configured in TWS.
  • Client ID - default: 1. No need to change this unless you have multiple data clients that are connecting to the same instance of TWS. Enter 0 (zero) if you wish to retrieve manual orders from TWS upon connection.
  • Delayed Data - check this only if you're evaluating TWS with delayed data.
  • Auto Launch IB TWS - check to allow WealthLab to automatically launch IB TWS when 1) IB TWS or Gateway is not detected to be running locally and IB connection is required for data or trading.
  • Option Chart WhatToRequest - Trades provides a chart based on option trading, whereas MidPoint provides a chart of the Bid/Ask MidPoint throughout the day. Because option trading most often is illiquid, when developing strategies that do not rely on contract trade volume, MidPoint is recommended. It's not currently possible to see both Trades and MidPoint, so you must decide which data you wish to retain.

DISCLAIMER:

The third party data is subject to the availability of the respective provider (website) and may be delayed or inaccessible periodically due to network or technical reasons. As the data is not guaranteed to be accurate, it is your responsibility to confirm that it does not contain errors before utilizing it for any type of backtesting or trading activities. Quantacula LLC is not to be held liable for any errors in market data or its inavailability.

Screenshots

Streaming Charts
Drive your realtime trading using your IB data subscriptions
Historical Data
Create and Update DataSets using IB data subscriptions
Automated Trading
Manually Stage and Place orders, or just let Wealth-Lab trade your strategies automatically!
Quote Monitor
Monitor and trigger your end-of-day orders using the Quotes tool
Connection Settings
Connect to TWS or the IB Gateway after a quick one-time set up

Change Log

Wealth-Lab 8 Build 50 - 4/22/2024
  • Added logic to handle an Auto-Trading edge-case scenario: if an existing Limit/Stop Order has ‘just Filled’ when attempting to cancel/change the order, the broker will report an Error “cannot be canceled, state: Filled”. The IB Provider will detect this condition and update the order status as “Filled” instead of “Error”.
Wealth-Lab 8 Build 49 - 4/3/2024
  • Allow account refresh for a new connection to IB TWS/Gateway. It’s still only possible to connect to one instance of IB TWS/Gateway using the specified port.
  • Auto Launch IB TWS (if enabled) should launch the latest version installed.
Wealth-Lab 8 Build 48 - 3/27/2024
  • Added a conversion to the symbol format used for WealthLab trading for futures and option symbols in IB’s TradeHistory files.
  • Fix: Return the Market from cache (IBContracts.txt) even when not connected to IB.
Wealth-Lab 8 Build 47 - 3/18/2024
  • Fix for Trade Parser for trade quantities 1,000 or above.
  • Removed native provider support for 20-minute bars. (This interval fails when polling in the Strategy Monitor because the timestamps don’t align properly with the market opening time.)
Wealth-Lab 8 Build 46 - 3/14/2024
  • Fix to return Index option contracts for regular AM expirations (the last trading date is the day before the expiration date).
  • Adapted to CBOT’s change to standard Local Symbol. If you trade CBOT futures, remove all records containing |CBOT| from IBContracts.txt (File > Open WealthLab User Data folder).
  • GetOptionsSymbol() optimized to identify valid option contracts if a local data file exists.
Wealth-Lab 8 Build 45 - 3/5/2024
  • Return account total cash balance in user’s IB BASE currency.
  • Improve references for contract caching.
Wealth-Lab 8 Build 44 - 2/23/2024
  • Amplified search for valid option strikes to 10. Previously, the search gave up after 4 attempts which could still return an invalid contract symbol from the chain that had not started trading.
  • Fix: Apply the contract’s PriceMagnifier to IB broker positions whose contracts are quoted in cents but priced in dollars.
  • Fix: Broker Positions will match contracts by Local Symbol, Currency and Security type to prevent ambiguity in Account positions.
  • Fix: Identify CFD contracts so that Portfolio Sync can match the traded symbol.
  • Note! See Help > Interactive Brokers for more info to set up IBContracts.txt for trading CFDs - especially for Forex trading.
Wealth-Lab 8 Build 43 - 2/15/2024
  • Fixed and improved search for valid option contracts.
  • Change: use only the Local Symbol to identify an option contract so that index option contracts can be identified (no change for other contracts).
Wealth-Lab 8 Build 42 - 2/9/2024
  • Target .NET8.
  • For STK and CRYPTO, further adjust Stop and Limit prices placed by the broker provider per the contract’s “Market Rule”, which may identify different minimum tick values as a function of price levels.
Wealth-Lab 8 Build 41 - 1/22/2024
  • Patch IB’s API to fix parsing error when a whitespace is used as the Windows number grouping character.
Wealth-Lab 8 Build 40 - 1/18/2024
  • Fix for IB Trade Parser.
Wealth-Lab 8 Build 39 - 1/6/2024
  • Fixed identifying Market by Primary Exchange.
  • Added IBDefaultMarkets.txt file to identify a default market by the contract’s currency.
Wealth-Lab 8 Build 38 - 1/2/2024
  • Implemented native ReplaceOrder. When Auto-Trading, a change in order quantity and/or stop/limit price is applied immediately.
Wealth-Lab 8 Build 37 - 12/13/2023
  • Weekly+ Strategy orders will be submitted as GTC.
Wealth-Lab 8 Build 36 - 10/8/2023
  • Fixed issue that caused a lag when Signals tab viewed while IB is not connected.
Wealth-Lab 8 Build 35 - 10/5/2023
  • Support new base class methods for returning SymbolInfo including decimals for a symbol.
Wealth-Lab 8 Build 34 - 9/12/2023
  • Access Realized, Unrealized, and Daily PnL of your account from a Strategy. Example: `WealthLab.InteractiveBrokers.PnL pnL = IBBroker.Instance.GetPnL(“accountId”);
Wealth-Lab 8 Build 33 - 8/28/2023
  • Indicate support for native MOC and LOC orders.
Wealth-Lab 8 Build 32 - 8/4/2023
  • Optimize search for valid contracts, minimize delay for repeat searches.
  • Fix: Streaming will work for Options configured for Midpoint pricing.
Wealth-Lab 8 Build 31 - 7/7/2023
  • Fix corrupted Build 30.
Wealth-Lab 8 Build 30 - 7/7/2023
  • IBAPI 10.22 with possible fix for parsing data on machines that use a whitespace digit grouping symbol.
  • IBFuturesMargin.txt updated from ibkr.com. To use updated futures margin values, delete IBFuturesMargin.txt from File > Open WealthLab User Data Folder.
Wealth-Lab 8 Build 29 - 6/24/2023
  • GetOptionSymbol() works harder to find a valid contract in the Option Chain.
  • Fix: Ensure subscription is canceled for market data after calling GetGreeks().
Wealth-Lab 8 Build 28 - 6/14/2023
  • New! - Option Greeks are implemented in the IBHistorical.Instance. You can get the TWS-reported greeks as well as ad-hoc values. See Help (F1) > Extensions > Interactive Brokers for details and examples. Some call signatures may have changed.
  • Breaking Change! - GetOptionsSymbol() was moved from BrokerBase to DataProviderBase, consequently, the call is now IBHistorical.Instance.GetOptionsSymbol().
  • Fix for EUREX contracts symbol change. If you use EUREX contracts like (DAXM23, MDAXU23, etc.) close WealthLab and delete IBContracts.txt and IBFutures.txt files in the User Data folder.
Wealth-Lab 8 Build 27 - 3/22/2023
  • Workaround IBAPI crash - do not subscribe to BTC.USD for the heartbeat if the local thousands separator is a whitespace.
  • Fixed a null reference when using GetQuote for an option symbol.
  • Fixed Streaming Bars initialization if a partial bar wasn't returned.
  • Fixed partial bars for 1-minute based charts.
Wealth-Lab 8 Build 26 - 2/14/2023
  • Fix incorrect Market by supporting BrokerBase GetMarketForSymbol().
Wealth-Lab 8 Build 25 - 2/10/2023
  • Use the number of decimals for limit/stop price and per the schedule set by the MarketId. This change [mostly] eliminates the need to round prices in order to avoid the "price does not conform to the minimum price variation for this contract" error message.
  • Note! Wealth-Lab currently rounds prices only by decimal places, it's possible that in some cases it will be required for you to manually round stop and limit prices to a tick value that isn't precisely a power of 10.
  • Fix - Avoid nuisance 'Outside Regular Trading Hours' is ignored warning for CASH when using Stop orders.
  • Improved messaging by attaching reasons for canceled and rejected orders.
Wealth-Lab 8 Build 24 - 1/21/2023
  • Update for exchange consolidation changes at IB.
Wealth-Lab 8 Build 23 - 12/15/2022
  • Fix exception if a bad symbol is passed to IB's GetSymbolDecimals method.
  • CBOT exchange consolidation. Any contract records that previously pointed to ECBOT should automatically direct to CBOT.
Wealth-Lab 8 Build 22 - 11/30/2022
  • Fix the number of decimals used for limit and stop orders (by instrument.)
Wealth-Lab 8 Build 21 - 11/25/2022
  • Fix: Streaming bars were initializing a bar's open to previous close if no trades occurred in the first 5 seconds of the new interval.
Wealth-Lab 8 Build 20 - 11/18/2022
  • IBContracts.txt, IBFutures.txt, and IBFuturesMargin.txt updates for exchange consolidations.
  • Minor code updates for the exchange consolidation
  • Important! To get the updated files, close WealthLab and delete these existing 3 files from your WealthLab User Data folder.
Wealth-Lab 8 Build 19 - 11/11/2022
  • Fix - System.InvalidOperationException during streaming (occurred rarely)
  • Fix - in some cases requesting intraday data for 24-hours markets could have left gaps. This fix will avoid the problem in the future, but you should check histories for gaps and refresh if required.
  • Implemented throttling for historic requests (5 max in 2 seconds) to help avoid an IB pacing violation. Collecting large amounts of intraday history is still likely to result in server pacing of 1 request every 6 seconds.
Wealth-Lab 8 Build 18 - 10/31/2022
  • Fixed a crosstalk issue when reporting batch updates.
  • Adapt to futures exchange consolidation - Waves 1, 2, and 3.
Wealth-Lab 8 Build 17 - 10/28/2022
  • Now uses IB API 10.19 and adapts to requirement to specify the time zone for historic requests.
  • Fixes possible gaps in intraday data for 24 hour markets.
  • Upgrade Compatibility Required! - Install TWS 10.17 (or later) for compatibility with IB Build 17.
Wealth-Lab 8 Build 16 - 10/11/2022
  • Fix - the scenario responsible for "duplicate orderID" is solved. Thanks to kls06541 for helping to isolate the issue.
  • Change - reduced the batch window for intraday requests for 24-hour markets to minimize data request timeouts.
  • New! - Preference to configure the delay for Final Orders. A new feature delays signals on the last bar of the day intended for the next session to avoid immediate order cancellation.
  • New! - IBBroker.Instance.GetOptionsSymbol() method supports both stock and futures options. Thanks to wesdutoit for his Concierge Service request that implemented futures options.
Wealth-Lab 8 Build 15 - 9/27/2022
  • Possible fix and more logging for very intermittent "Duplicate OrderID".
Wealth-Lab 8 Build 14 - 9/14/2022
  • Manage individual AccountUpdatesMulti subscriptions
  • Messaging to troubleshoot duplicate OrderId
Wealth-Lab 8 Build 13 - 9/12/2022
  • Revert to reqPositions to subscribe to position updates for all accessible accounts
  • Show Cash Balances in multiple currencies
  • Added a few Log Viewer messages to aid troubleshoot linked accounts
Wealth-Lab 8 Build 12 - 9/10/2022
  • Fixed base symbol for AUD currency futures in IBFutures.txt
  • Fixed contract symbol returned to the Broker Account for Euro futures and contracts whose last trade date is before the front month. (e.g., CL contracts)
  • Fixed Accounts tool's Basis Price value for futures
  • New! n-Second interval support for 10, 15, and 30-Second bars (only). "Faster" intervals return too many bars for our 1-day increment requests.
  • Change! If trading futures using 1-digit year symbols (e.g., ESU2), you must now map these to the 2-digit year symbol for IB in the Order Manager mapping, e.g., ESU2=ESU22. This is required to synchronize Position exits because Order Manager will now always return the 2-digit year symbol format.
Wealth-Lab 8 Build 11 - 9/1/2022
  • Avoid missing order status updates for new orders after a reconnect if IB doesn't send the openOrderEnd callback.
  • Avoid unnecessary requests for expired contracts less than 2 years expired.
  • Fix symbol used in request cache for futures and options.
  • Skip historical requests for expired option contracts and futures more than 2 years expired.
Wealth-Lab 8 Build 10 - 8/17/2022
  • Automatic lookup for EUREX Market. If you trade instruments on EUREX, you may need to create a Market named "EUREX".
Wealth-Lab 8 Build 9 - 8/4/2022
  • StopLimit Order Type support added (Build 13 required).
  • Adapt change from DTB to EUREX exchange for some Euro futures.
Wealth-Lab 8 Build 8 - 6/27/2022
  • Data Providers are now more careful about checking Offline Mode before making web requests (requires WL8 Build 10+).
  • Updated API to 10.16. No notable API changes, only internal compatibility.
  • Fix: Stop orders for Futures were not triggering outside of regular market hours. "Outside RTH" will always be set true for FUT and CASH stop orders.
  • Fix: SymbolInfo for CASH contracts.
Wealth-Lab 8 Build 7 - 6/14/2022
  • Support for Pre/Post Market orders.
  • Fixed a "light-weight" request that wasn't returning an account's buying power.
  • New IB Configuration option to return Bid/Ask Midpoint in charts instead of Trades data. Options are most often illiquid contracts, and pricing can move significantly from the last-traded price during the day. Midpoint provides Bid/Ask Midpoint OHLC bars continuously throughout the day, which should be more accurate pricing for backtesting.
  • SymbolInfo for BarHistories will automatically "load" with the contract details. In most cases it won't be required to make entries for new IB contracts in Markets & Symbols.
Wealth-Lab 8 Build 6 - 5/26/2022
  • Resolved some issues around latency in IB Account updates.
  • Fix for KeyNotFoundException when using Streaming Bars
Wealth-Lab 8 Build 5 - 5/13/2022
  • Quick failure return when requesting a contract without data permissions. Previously, requesting a contract without data permissions would "spin" many unnecessary requests.
  • Handle TWS not installed at c:\jts, or, just TWS not installed.
  • Fix - Cash and Cryptos contracts were defaulting to STK types in Accounts.
Wealth-Lab 8 Build 4 - 5/2/2022
  • Fixed some data issues for customers with non-USD regional settings.
Wealth-Lab 8 Build 3 - 4/21/2022
  • Adaptation for new LimitClose Order Type, and IB supports LOC orders if enabled in Trading Preferences.
Wealth-Lab 8 Build 2 - 4/14/2022
  • Futures and Options - symbol matching and basis price adjustment.
Wealth-Lab 8 Build 1 - 4/10/2022
  • Initial WL8 release.
Wealth-Lab 7 Build 20 - 3/2/2022
  • Change: STP LMT orders entered in IB TWS will now appear as Stop instead of Limit orders in Wealth-Lab. (Note: To get open orders entered manually in TWS, you must use Client ID 0 in the IB Configuration.)
  • Minor code optimization for streaming.
Wealth-Lab 7 Build 19 - 2/7/2022
  • New: Option to enable/disable auto launching TWS
  • Change: If a symbol record doesn't exist in Markets & Symbols, IB Build 19+ will assign the market using the contract's exchange for all security types (not just futures). If a Market doesn't already exist for a symbol's exchange, you should create one.
  • Change: Automatic assignments for the major markets listed in Markets and Symbols are now assigned based on the contract exchange. For example, "Hong Kong Stock Exchange" Market for symbols with contract exchanges HKFE and SEHK; "Brazil Bovespa" for BOVESPA, "Frankfurt Stock Exchange" for IBIS and FWB, etc.
  • Internal change: The TWS Time Zone and offsets are calculated in a different way. You shouldn't notice a difference, and charts should continue to display data in the assigned Market's time zone.
  • Fix: Don't update a streaming bar with zero volume except for Cash and Index contracts that don't return volume.
  • Fix: prefix and extra day for intraday requests for contracts that trade through midnight so that data isn't skipped.
  • Work continues to reconnect after a TWS restart. Currently, following a TWS restart, you need to re-initiate the connection in the normal ways (Order Manager Connect button, request chart data, etc.)
Wealth-Lab 7 Build 18 - 1/28/2022

New!

  • We recommend using Streaming Bars in the Strategy Monitor for Interactive Brokers Streaming. Streaming Bars create a real time replica of intraday historical bars with at least 10 times less processing required than Streaming. (Streaming chart data often results in minor differences from historical bar data because the "ticks" are conflated and updated no faster than 4 times per second.)

Change:

  • Enabled connecting to a network machine by attempting a connection before checking if TWS or IB Gateway is running locally. TWS or IB Gateway must already be running on the other machine and you must ensure your firewall is configured correctly.

Fixes:

  • IB configuration is loaded after a restart
  • Load zero volume bars for index (IND) contracts (streaming and historical providers). Initially, you should request data for index contracts using the explicit specification, e.g., SPX;IND;USD;CBOE to create the contract reference. Thereafter you can just use the symbol, e.g., SPX. See Help > Interactive Brokers for more examples.
  • 100x volume multiple is for US stocks only. Previously, volume was multiplied by 100 for any instrument assigned to the default U.S. Market, not just STK security types.
  • Fix for parameter changes not always sticking.
Wealth-Lab 7 Build 17 - 1/19/2022

Fixes

  • Correctly identify option contracts with decimal strikes
  • Fix streaming volume for non-stock contracts

Changes

  • Calculate midpoint for streaming forex charts. Previously, streaming charts were updated with bid prices only.
  • Ignore streaming subscribe requests for expired futures or options contracts
  • Change IB's heartbeat symbol to BTC.USD for more coverage. EUR.USD will be used on Fridays since Forex closes 1 hour later than PAXOS.
Wealth-Lab 7 Build 16 - 1/10/2022

IB Data Provider "Overhaul" with breaking changes.

You must upgrade to TWS Latest version 10.12+ to use Build 16.

Fixes and other changes

  • Corrected removal of a bar from the end of each historical batch request made during market hours.
  • Trade volume will be far more accurate for streaming charts.
  • Corrected volume for non-U.S. stocks in historical charts. You should refresh non-U.S. stock charts to correct the cache for 100x volume
  • Ignore zero-volume bars in historical data for non-CASH contracts
  • Ignore Closing data returned with negative or zero values; adjust OHL appropriately for neg/zero values.
  • Consolidated the "Market data farms OK" messages to a single log message.

New!

  • Wealth-Lab will display batch request messages in the Chart Status Bar when making multiple requests for data. We recommend that you limit intraday chart requests by setting a small range (e.g. 2000 bars) in Data Preferences.
  • A SecurityName will be displayed for new chart requests. You may need to reload older charts to retrieve the name.

Crypto Support

Added data and trading (beta) support for cryptos: BTC.USD, BCH.USD, ETH.USD, LTC.USD

  • Trading Cryptos has not been tested with Build 16.
  • Extra data permissions are not required for cryptos, but you must upgrade to the TWS Latest v10.12 to access them.

U.S. Options

  • Simplified specification of U.S. option contracts to this format: [Symbol][yyMMdd][C/P][Strike]. e.g, for ATVI's June 17, 2022 67.5 Call, enter: ATVI220617C67.5

U.S. and Euro Futures

  • Major upgrade to simplify futures contract specification. An IBFutures.txt file will be loaded in the User data directory that contains many U.S. and European futures contract specifications. When a contract is defined in IBFutures.txt, you only need to type a futures symbol with the symbol-month-year format. e.g. ESH2 or ESH22.

  • The first time you make a data request for a non-expired futures contract, the Provider will add a record to IBFutureSymbolSpecs.txt in the User data directory. This file contains future specs (margin, point value, min tick, etc.) that can be pasted in Symbols.txt. Futures margin is based on exchange requirements for Initial Margin in December 2021.

  • Data request dates are automatically controlled for expired futures contracts.

  • Added support for continuous contracts. Instead of a letter month and year, use #C, e.g., ES#C, CL#C, GC#C, etc. -- Note! Do not use Continuous Contracts for trading.

  • Let us know if you trade non-U.S. options in the Discussion forum!

Wealth-Lab 7 Build 15 - 12/21/2021
  • Added an IB-specific Parser for the Trade History Strategy type.
  • Changes to adapt to WL7 framework changes in Build 42.
Wealth-Lab 7 Build 14 - 12/7/2021
  • Fixed order status updates not ocurring issue.
Wealth-Lab 7 Build 13 - 12/3/2021
  • Avoid requesting entire intraday history when a Max Bars Data Range is selected.
Wealth-Lab 7 Build 12 - 11/30/2021
  • Minor changes to take advantage of better data loading mechanisms in WL7 Build 37.
  • Beefed up error handling and logging.
Wealth-Lab 7 Build 11 - 11/26/2021
  • When active OCO orders are reloaded, they will show OCO link icon.
Wealth-Lab 7 Build 10 - 11/22/2021
  • Extend end date requests one day into the future to account for different time zones.
  • Active orders will now populate into the Order Manager when IB Broker is connected.
Wealth-Lab 7 Build 9 - 11/12/2021
  • Provider marked as not supporting parallel updates.
Wealth-Lab 7 Build 8 - 10/21/2021
  • The VIX futures contract wouldn't come back before. It's required to specify the IB Local Symbol for futures contracts if it's different than the IB Symbol, in this case, VIX and VX.
  • Improve performance when canceling Data Requests.
Wealth-Lab 7 Build 7 - 9/20/2021
  • Connecting will now launch TWS if TWS or IB Gateway is not already open.
Wealth-Lab 7 Build 6 - 9/3/2021
  • Support for native OCO (One-Cancels-Other) orders.
  • Support for MOO (Market on Open) orders.
Wealth-Lab 7 Build 5 - 8/19/2021
  • Update for new Accounts framework, display accounts and positions info in Accounts window.
Wealth-Lab 7 Build 4 - 6/12/2021
  • Fixed bug preventing short orders from being placed.
Wealth-Lab 7 Build 3 - 3/30/2021
  • Fixed historical requests for Forex data.
  • Refer to Help > Extension > Interactive Brokers for guidance on entering symbols/contracts.
Wealth-Lab 7 Build 2 - 3/17/2021
  • Fix: multiple simultaneously placed orders were failing for duplicate order IDs.
  • Integrate help topic: Extensions > Interactive Brokers.
Wealth-Lab 7 Build 1 - 3/9/2021
  • Baseline release.

Discussions