# Connection to Interactive Brokers

* [**Data Limitations**](#data-limitations)
* [**Necessary steps for successful connection to FundX**](#necessary-steps-for-successful-connection-to-quantower)
* [**How to connect to Interactive Brokers using TWS platform**](#how-to-connect-to-interactive-brokers-using-tws-platform)
* [**How to connect to Interactive Brokers using IB Gateway**](#how-to-connect-to-interactive-brokers-using-ib-gateway)
* [**Problems during the connection to Interactive Brokers**](#problems-during-the-connection-to-interactive-brokers)
* [**How to subscribe to IB market data**](#how-to-subscribe-to-ib-market-data)

## Data Limitations

Interactive Brokers places the following limitations on real-time and historical data accessible to 3rd party applications

* **Pacing Violations** – TWS limits the number of requests for data. If too many requests for data occur in a short period of time, you may see error messages indicating “Pacing Violation”. If this happens you may need to wait a few minutes before trying to load data again.
* **Real-Time Quotes** – TWS does impose limits on the number of active tickers (typically around 100). Additional booster packs can be purchased from IB to work around this issue: [Booster Packs](https://www.interactivebrokers.com/en/index.php?f=14193).
* **Delayed Data Not Supported** – TWS does not provide access to delayed historical data and quotes.

For more details on these limitations see [IB Data Limitations](https://interactivebrokers.github.io/tws-api/historical_limitations.html#gsc.tab=0).

{% hint style="warning" %}

* IB does not currently offer full depth market data for futures.
* Market data updates are not frequent; therefore, we do not recommend using IB data (instead we recommend using dxFeed or Iqfeed as market data provider).
  {% endhint %}

## Necessary steps for a successful connection to FundX

This guide will help you to configure the connection to the Interactive Brokers and start working on FundX platform.

{% embed url="<https://youtu.be/dhz2OkwfDSg>" %}
Video connection guide to Interactive Brokers
{% endembed %}

* [**Download**](https://www.quantower.com/) and install FundX trading platform (if you haven’t it yet) of an appropriate version (32 bit or 64 bit), and make sure that your PC complies with the [**minimum requirements**](https://funded-futures-network.gitbook.io/fundx/getting-started/installation#pc-requirements)\\
* To connect to IB, you need to have (or create) a [**demo**](https://www.interactivebrokers.co.uk/en/index.php?f=1286) or [**real account**](https://www.interactivebrokers.com/en/home.php) by clicking the appropriate links on the Interactive Brokers official website.

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-d09512123f86fa97283905dee9df5adb52e6741b%2Fimage%20\(327\).png?alt=media)

* Download and install IB Software — [**TWS (Trader Workstation)**](https://www.interactivebrokers.co.uk/en/index.php?f=14099#tws-software) or [**IB Gateway**](https://www.interactivebrokers.co.uk/en/index.php?f=16454) on their website.

{% hint style="success" %}
The difference between IB Gateway and TWS is that IB Gateway has a lighter and less sophisticated graphical user interface (GUI) than TWS.
{% endhint %}

![Download Trader Workstation (TWS) or IB Gateway](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-8d00980b4de13498e87df6e542e5d7547a3001d7%2Fimage%20\(328\).png?alt=media)

## How to connect to Interactive Brokers using TWS platform

* Launch TWS and enter your **Username** and **Password** into it, that you received from the broker and click on **Log In** button.

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-fa9ceea232c1ea40004812818b39bdd8ca0e4ede%2Fimage%20\(325\).png?alt=media)

* Once you are logged in, open the additional settings in TWS: **Configure**. Select **API** section - > **Settings** and check to **Enable ActiveX and Socket Clients** box as well uncheck **Read-Only API**

![Diactivate Read-Only API and check Socket Clients in TWS platform](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-610f393765517f9c7202bc8955373c6b51fae64a%2Fimage%20\(324\).png?alt=media)

* Select **API** section - > **Precautions** and activate all checkboxes.

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-1685d27c7f6865eb5fe9f57ac57d61c0a76acc65%2Fimage%20\(323\).png?alt=media)

* Next, check that the TWS platform is selected in the connection settings in the FundX platform.

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-25e30740aa161958cbe198f8a4faec5ab2d0cfeb%2Fimage%20\(326\).png?alt=media)

* Click on the **CONNECT** button and the platform should connect correctly. If you have some errors during connection, please check [**the most common errors**](#problems-during-the-connection-to-interactive-brokers) (below) or contact our support team via Live chat on our [website](https://www.quantower.com/), via email <info@quantower.com>.

## How to connect to Interactive Brokers using IB Gateway

* Launch IB Gateway and enter your **Username** and **Password** into it, that you received from the broker and click on **Log In** button.

{% hint style="warning" %}
For **IB Gateway** in the API Type section select **IB API** only!
{% endhint %}

![Select API type and enter Login and password for IB Gateway](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-1060c3a1ef76cab320ef2bee290d7c828c69d8a2%2Fib-gateway-credentials.png?alt=media)

* Once you are logged in, open the additional settings in IB Gateway: **Configure**-> **Settings**. Select **API** section - > **Precautions** and activate all checkboxes.

![Activate all checkboxes in the IB Gateway API settings](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-a37c0300cd9c409e360ddc799d19c2a38c59e8c0%2Fimage%20\(322\).png?alt=media)

Also necessary in the **Settings** section deactivate the **Read-Only API** to perform trading operations.

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-34e1e35fa13278ad78e93dec49b48fbae4b678a0%2Fimage%20\(329\).png?alt=media)

* Next, check that the IB Gateway is selected in the connection settings in the FundX platform.

![Check connection settings and Click on the Connect button once you are logged in to IB Gateway](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-574177635e8ff78b78775bbb0d3f0f5897d645ed%2Fimage%20\(330\).png?alt=media)

* Click on the **CONNECT** button and the platform should connect correctly. If you have some errors during connection, please check [**the most common errors**](#problems-during-the-connection-to-interactive-brokers) (below) or contact our support team via Live chat on our [website](https://www.quantower.com/), via email <info@quantower.com>.

## Problems during the connection to Interactive Brokers

* ***Wrong Connection Parameters***
* ***Trader Workstation is not running***
* ***The Price Does Not Conform to the minimum price variation for this contract (FOREX symbols)***

There may be some problems during the connection to Interactive Brokers, for example, ***Wrong Connection Parameters***

![Wrong parameteres during connection to Interactive Brokers](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-a8a9d0ffb1d1f41bc4eb05aba3f3a7d1b4537d24%2Fconnections-manager-for-ib_error.png?alt=media)

In this case, you need to check the connection settings in our platform and in the TWS platform (or IB Gateway). In our platform, go to the **Connection Settings.**

![Connection settings in FundX for Interactive Brokers](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-ef7d151192a6b12f05ca7327884292b8c67fcb7c%2Fconnections-manager-for-ib_settings.png?alt=media)

Select the application through which you are connecting — TWS platform or IB Gateway.

![Select the necessary connection port type](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-c9af6f19101cb72a0b8a069f6cf8a1d332b06de7%2Fconnection-settings-for-ib.png?alt=media)

If the problem persists even after choosing the right application, you need to configure the ***Socket port*** in TWS (or IB Gateway) and FundX.

![This Socket port in TWS (or IB gateway) should be the same as in FundX](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-2b81a4bc17d998c379c5d07c13a014ebae85cdbd%2Fsocket-port.png?alt=media)

Select the ***Custom*** connection port type in the Connection settings of FundX and set the ***Port Value***

### ***Trader Workstation is not running***

![Trader Workstation is not running. Please launch it to connect to IB](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-f9b7cd26637f2d1238b51c43a5d0efecd90d8776%2Fconnections-manager-for-ib_tws_error.png?alt=media)

Connection to Interactive Brokers is made through their TWS trading platform or the IB Gateway application. To successfully connect to IB you need to run their applications.

If you have any other problems during the connection to Interactive Brokers, please contact us in support and we will help you. <https://www.quantower.com/contact-us>

3\. ***The Price Does Not Conform to the minimum price variation for this contract (FOREX symbols)***

By default, placing orders on Forex pairs in IB is carried out at prices equal to 1/2 pip. Like on the screenshot below:

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-c8fdb23dd42859406f15d1ca5c63fdc49e359d52%2Fimage%20\(99\).png?alt=media)

If you place orders in FundX at prices between those specified, for example 1.19382, you will get a message: ***The Price Does Not Conform to the minimum price variation for this contract (FOREX symbols).***

To solve this problem and to be able to place orders at any desired prices, you need to activate the setting in the TWS platform (or in IB Gateway)

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-d52c8c912c50f3fa681d5963dc90a48d0135f3db%2Fimage%20\(98\).png?alt=media)

## How to subscribe to IB Market Data

Requests for trading permissions and market data subscriptions are submitted through **Account Management** on the IB website.

If market data is not subscribed, you will see error messages similar to the following:

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-cf988238885f4a613fcecc7b25ee565b9bb58a6d%2Fimage%20\(319\).png?alt=media)

To subscribe to Market data with IB, please go to the Account Management section. Open the TWS platform and from the main TWS screen by clicking the **Account** menu at the top of the screen and then selecting **Account Management Home.**

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-6e47e0cf5e9ef767a301d9bd0b42e263376e0e05%2Fimage%20\(318\).png?alt=media)

This will open the Account Management page without requiring that the account username / password be re-entered.

At the bottom of the Account Management page, you can find the link to the [**Market Data Subscriptions**](https://ndcdyn.interactivebrokers.com/AccountManagement/AmAuthentication?action=TA_MARKET_DATA). Click on the **Gear** icon to customize your subscription to the necessary market data.

After this is done, **restart Trader Workstation platform**. FundX will establish a new connection and you should then receive market data.

![](https://1574671354-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQAglKSOJnxCrGxFyuplO%2Fuploads%2Fgit-blob-2ee7efa368717a79b7c29ebb5a1ea4c784f62271%2Fimage%20\(320\).png?alt=media)
