Knowledgebase: How to setup Interactive Brokers (IB) data feed
Posted by Nicholas Bender, Last modified by David Jones on 09 April 2020 13:06
Prerequisites for using the Interactive Brokers (IB) data feed
You must have the IB TWS (Trader WorkStation) desktop client installed on your machine. We recommend you use their 'time-tested' version only. The API will not work with IB WebTrader. You can download TWS from the following link: http://www.interactivebrokers.com/en/index.php?f=674
It is not required to download/install the IB API. TWS version 952.3b or later will be required.
Getting Started with the IB data feed
For ONE to access the Interactive Brokers data feed, the IB TWS desktop client must be running.
First, in TWS go to Edit->Global Configuration, which will open the Trader Workstation Configuration window (as shown below). Click on API->Settings on the left hand menu and check the following:
- Make sure ‘Enable ActiveX and Socket Clients’ is checked.
- Make sure the host Port setting in ONE matches the Port setting in TWS API (both default to 7496).
- If you do not want TWS to keep prompting you each time ONE tries to connect, you can add the local host (127.0.0.1) to your Trusted IP Addresses. Please be aware that if this setting is added, ANY application that tries to connect from your PC will be able to do so without TWS prompting you for confirmation, although you may hear IB TWS beep each time a request is made.
- If you have made any changes, press the ‘OK’ button to confirm them.
To start using the Interactive Brokers live data feed, go to the Configuration ribbon in ONE and change the ‘Live Feed’ drop down control to ‘Interactive Brokers’. The ‘Host Address’, ‘Port’ and ‘ClientId’ fields will be displayed and contain the following default values:
Again, make sure the ‘Port’ is the same as that configured in the TWS API settings.
If you have other applications connecting to TWS, please make sure you allocate a unique ‘ClientId’ to ONE and enter it in the Data Feed Configuration setting.
Finally, click on the LIVE button in the ONE Home ribbon to start the data feed.
Error Message and Still No Prices?
If you receive an error message when clicking on the LIVE button, then the IB API has not been installed correctly.
You can quickly check this by trying to run any of the IB API example programs (one of which is located in C:\TWS API\samples\TestActiveX_VC\Release\client3.exe) to check that the IB API is working and allowing third-party programs to connect to TWS.
- If you can find this program, start TWS and then run the example program C:\TWS API\samples\TestActiveX_VC\Release\client3.exe. Click on the 'Connect...' button at the top of the window, followed by 'OK' on the popup window. If you receive a message 'Couldn't connect to TWS.' in the bottom textbox then the IB API has NOT been installed correctly. We suggest you contact IB support for assistance in installing their API ActiveX software.
- You will need to ensure that you have the required real-time Market Data Subscriptions (for both the underlying exchange and options exchange) in your IB account to access the requested data - delayed or snapshot data is not sufficient.
- Option prices are not available from the IB data feed outside of market hours, therefore ONE may display zero mid prices.
- Depending on the number of concurrent data requests made, you may need to purchase additional market data via IB Quote Booster subscriptions, although we have not found this necessary during testing.