undefined

Using Third Party API Platforms

Third party software vendors make use of the TWS' programming interface (API) to integrate their platforms with Interactive Broker's. Thanks to the TWS API, well known platforms such as Ninja Trader or Multicharts can interact with the TWS to fetch market data, place orders and/or manage account and portfolio information.

  • It is important to keep in mind that most third party API platforms are not compatible with all LYNX account structures. Always check first with the software vendor before opening a specific account type or converting an LYNX account type. For instance, many third party API platforms such as NinjaTrader and TradeNavigator are not compatible with LYNX linked account structures, so it is highly recommended to first check with the third party vendor before linking your LYNX accounts.

A non-exhaustive list of third party platforms implementing our interface can be found in our Investor's Marketplace. As stated in the marketplace, the vendors' list is in no way a recommendation from LYNX. If you are interested in a given platform that is not listed, please contact the platform's vendor directly for further information.

Frequently Asked Questions

Below is a list of frequently asked questions. All answers are given considering a standard usage of the TWS. Note that some vendors might provide an additional customization level to simplify things. If the below description does not reflect the way you operate your third party software with the TWS, please contact your vendor directly.

How to connect a 3rd party platform to LYNX' Trader Workstation

Connecting any third party program to the TWS requires you to enable API connectivity on the TWS itself as explained in Enable API connections section. Your third party program will need to provide means for you to specify at least a host and a port. In the vast majority of cases the third party program will be running on the exact same computer as the TWS therefore the host IP can be specified as 127.0.0.1 whereas the port needs to be the exact same as the one configured in the TWS' API Settings, typically 7496 or 7497. Below is an illustration showing one of our API sample applications highlighting the typical connectivity fields a program connecting to the TWS should provide. Note there is an additional field for "clientId". You can set this id to any positive integer including zero or to whatever your third party application's provider recommends.

[!NOTE] For vendor-specific instructions please contact your third party provider directly.

sample_app_connect.png

Where to get support for a third party software connecting to the TWS.

LYNX cannot provide any kind of support or advice for software not developed by LYNX itself. Depending on the nature of your inquiry, our support staff's advice might be quite limited since in most of cases it is not realistic to reverse-engineer a third party program in order to understand how is it using our API. Because of this, the third party vendor's support team should always be the first contact option.

The vendor of my program did not find any issue on its side and asked me to contact my Broker directly.

There will be occasions when a given operation will not be fulfilled as expected not because of a malfunction in either platform but because of the business logic involved. The typical behaviour of the TWS is to either perform the requested operation or to return an explanatory message which will point you in the right direction. It is the duty of the third party program to clearly show these TWS' messages within its own user interface. Without a relevant error message our support team will not be able to give any advice.

In case of a malfunction on Interactive Broker's side, clear and concise technical information needs to be provided including evidence of the malfunction in the form of TWS or API message log files as detailed in Log Files section of this guide. Collecting all the needed information is not a trivial process and might require a very detailed knowledge of our API. To prevent being caught in between support teams, please request your third party vendor to contact us directly with as much information as possible.

TWS generates warning messages that block my orders being automatically transmitted.

There are precautionary settings in TWS that are designed to be a order safety check. TWS would usually generate a pop-up warning dialogue, or sent back an error message via the API, when there is any violation to the pre-define precautionary settings in TWS Presets.

For users who uses a third party software to place orders but also receives data feed from a different vendor other than IB, TWS would also generate a default warning *"You are trying to submit an order without having market data for this instrument"* on receiving orders from third party. The checked order will not be transmitted automatically unless user click "Transmit" button of the order in TWS.

TWS precautions can be bypassed by navigating to File/Edit → Global Configuration → API → Precautions, and check the box *"Bypass Order Precautions for API Orders"*. Once this is done, API orders placed from a third party software will not be checked by TWS precautions.

I cannot see any market data in my third party program

As explained in our Streaming Market Data page, in order to be able to pull market data from the TWS, you need to acquire the Live Market Data of the product(s) you are interested in.

I do have the Live Data Subscriptions I need but when using my paper trading user name I am still unable to obtain it.

Make sure you are Sharing Market Data Subscriptions

I am obtaining a message saying "Historical data request pacing violation"

Please refer to our Historical Data Limitations page

My third party program shows "No data of type EODChart is available" when trying to load a chart

This message is returned when the requested End of Day (EOD) market data is not available in our systems. You can easily verify this by loading the exact same chart using the TWS to obtain the same result:

no_eod_data.png

Please contact our General Support team's Market Data department for further information.

I am obtaining a "HMDS query returned no data" message.

Sometimes the data prior to the specified requested date is also not available for several reasons. Suppose a product started quoting (generating data) on 1st January 2016 but your third party program requests data prior to this date. To prevent this error message adjust your third party program's charting parameters accordingly.

I cannot chart CFDs from my third party program yet the TWS shows the data correctly.

Except for Index CFDs, CFDs do not have any market data of their own. What the TWS displays is the CFD's underlying contract's data. Whenever you try to fetch non-Index CFD data from the TWS, you will obtain an error message asking you to pull it's underlying contract's data instead. Some third party programs' user interface only allow placing orders via their charts. Given that no data can be loaded for these products and the impossibility of the third party program to apply a similar conversion as the TWS, you might find your third party software not able to place orders as a consequence!

How can I connect my third party program to my paper trading account?

Connections via the TWS API are not aware of the user name with which you are logged in with in your TWS. From this point of view the API makes no difference between live or paper trading. Since third party programs only connect any running TWS on the specified host and port it only takes you to launch the TWS and log into it with your paper trading credentials, make sure you Enable API connections and connect to it from your third party application using the same procedure.

Can I connect simultaneously to my live and paper TWS?

From our side, yes. You can launch as many instances of the TWS as you need using different user name/password combinations. It is crucial though to make sure each TWS is listening on a different port as described in the Enable API connections section. Note that your might as well need to launch multiple instances of your third party program and/or have a way of telling when is your program using the paper or the live accounts.

The charts shown by my charting software differ from the ones shown by the TWS

Given that the historical data sent down the TWS API comes from the same source as the one displayed by the TWS itself it is almost impossible for it to differ.

Some charting platforms circumvent our Historical Data Limitations by combining real time and historical data. Since our real time market data is not tick-by-tick, bars built from it will hardly match those retrieved from our historical market data service.

Alternatively, you might as well be comparing different charts without noticing. A chart displaying data from NYSE will never be the same as another built from the ARCA exchange or from our SMART routing strategy. inadvertently you might as well be looking at TRADES on one side while having MIDPOINT or BID_ASK on another. Another common mistake involves having different timezones between the TWS and your client application.

Is there a fee involved to receive data from the API?

Streaming real time data or receiving historical bars from the API requires streaming level 1 market data subscriptions. Subscriptions for instruments other than forex, bonds, and index CFDs incur a monthly fee. Market Data

Can the TWS API be used with trial accounts?

Yes it is possible to connect an API application to a trial account. However it is not possible to receive real time market data or historical candlesticks for most instruments from the TWS API with a trial account login.

What types of APIs are available?

There is an API for Traders Workstation (TWS API). It is the most full-featured and can be used by all clients with trading access. There is a WT Web API for white-branded advisors and introducing brokers that provides streaming and historical data. There is a REST WebAPI for third party companies and institutions. It can be used to place stock and forex orders, receive market data snapshots, and receive account and portfolio information.

What are differences between connecting to the TWS API and using a FIX/CTCI connection?

The TWS API is an interface to TWS or LYNX Gateway. It provides many functionalities, such as the ability to receive market data, place orders, and receive account information. The TWS API requires that the user first login to either TWS or LYNX Gateway, both standalone desktop applications. The TWS API has an order rate limitation of 50 orders per second.

FIX/CTCI connectivity can be configured to connect either with LYNX Gateway or directly to IB. Unlike the TWS API, FIX/CTCI is only for order placement and can not be used to receive market data. Also, FIX/CTCI has monthly minimum commissions involved.

Can I use another trading application (LYNX mobile, WebTrader, TWS) while an API program is connected?

To connect to the same LYNX account simultaneously with multiple trading applications it is necessary to have multiple usernames. Additional usernames can be created through Account Management free of charge. Market data subscriptions however only apply to individual usernames so the fees would be charged separately.

Can the TWS API be used with any LYNX account?

Most third party API applications do not support all LYNX account structures, so it is highly recommended to consult with the third party software vendor before opening or converting to a specific LYNX account type to use with a third party application.

Why does an order from the API appear as untransmitted in TWS with a 'T' button next to it?

If an order appears in TWS as untransmitted and is not sent to IB, there are generally three causes: (1) There is an error in the order preventing transmission (2) There is a TWS precautionary setting preventing transmission to LYNX. Precautionary settings can be globally overridden in TWS through the settings in Global Configuration at API -> Precautions -> Bypass Order Precautions for API Orders (3) The order was sent with the 'transmit' boolean flag in the API Order class set to False. By default, its value is True.

Is autolaunching of TWS or LYNX Gateway supported by LYNX?

Unfortunately for security reasons auto-launching of TWS or LYNX Gateway is not supported. Both applications are designed to require the user to manually enter his or her credentials into the UI.

Is it possible to disable the daily auto-logoff requirement of TWS?

Current versions of TWS and LYNX Gateway (974+) have the ability to automatically restart daily without user authentication at a chosen time from Monday-Saturday. On Sunday, following the Saturday night server reset, it is necessary for the user to re-authenticate any running session of TWS or LYNX Gateway. With the auto-restart option chosen in the settings, the session is designed to be able to continue until the following Sunday as long as there are no other logins with the same username to Client Portal, TWS, or LYNX mobile.

Do you recommend any third party products or programming consultants?

LYNX does not recommend particular third parties, but a list is maintained on the Investors Marketplace. Marketplace

What are the differences between using an API application with TWS and LYNX Gateway?

From the point of view of an API application, TWS and LYNX Gateway are essentially identical. TWS additionally offers the user the ability to directly view positions, trades, and market data, and provides a number of tools for trading, research, and analysis. LYNX Gateway has a simple graphical user interface that is only used for modifying settings. The advantages of LYNX Gateway is that it consumes 40% fewer resources and can run for longer periods without automatically closing down. Link

Is it possible to run TWS or LYNX Gateway on a headless server?

Both TWS and LYNX Gateway are designed to have a user interface for the client to enter their account credentials. For that reason, headless or GUI-less operation is not supported.

Do I ever need to upgrade the TWS API?

TWS is very backwards compatible with the API so it is not necessary to upgrade the API when upgrading to a new version of TWS. Generally the only reason it is necessary to upgrade the API is to take advantage of a new feature introduced in a more recent API version.

The data indicator in LYNX Gateway is red. Is something wrong?

It is normal for the market data farm connection indicator to stay red until a market data request is made from the API application. The farms can also turn red after extended inactivity.

How do I report a problem to the API Support team?

Diagnosing specific issues will generally require that API logging is enabled in TWS or LYNX Gateway when the issue occurs. In TWS this is done by navigating to Global Configuration -> API -> Settings and checking the box "Create API Message Log", and setting the logging level to "Detail" In LYNX Gateway, these settings are found at Configure -> Settings -> API -> Settings If an issue occurs after logs are enabled, they can be uploaded using the combination Ctrl-Alt-Q and then clicking Submit. Please let API Support know logs have been uploaded.

Are historical account positions or account values available from the TWS API?

Since the API cannot provide information not available in TWS, historical portfolio information is not available. It is available from statements and flex queries in Account Management.

Does LYNX provide hosting services for custom algorithms?

Unfortunately no, web hosting is not provided.

Is there an Excel API for MacOS?

The Excel APIs require a Windows computer with Microsoft Excel.