Architecture of an Interactive Brokers Based Trading System

This page discusses the Interactive Brokers Java API for software model driven trading. Interactive Brokers (IB) seems attractive because they seem to have robust support for Java. From the start IB has designed their trading interface to support custom software trading platforms. They have grown into a sizable broker, supporting a significant trading volume. For sufficiently funded accounts they also support 4 to 1 leverage.

Interactive Brokers Professional Services Support

Their professional services toll free support line is: 866-694-2757

Interactive Brokers API Users Guide

Users Guide (on line version)
API guide (PDF format)

Minimum Account Size

The exchanges (NASDAQ and NYSE) require a minimum balance of $25,000 (US) for an account that can support computer trading and multiple transactions per day. If this balance is not maintained, the exchanges require trading to be terminated. In practice this means that computer trading requires at least $35K (US) and probably something closer to $50K as a minimum.

Connectivity to IB

IB supports trading over the Internet. This means that trading transactions can be victims of Internet connectivity and routing. Through Speakeasy (Ian's ISP) a round trip packet transaction to IB takes about 93 msec. Note that this is the packet latency. Multiple packet transactions can be outstanding. But the base latency over my ADSL connection means that a trading platform running on my Linux system might max out around 50 order transactions a second, which is the IB maximum for the Java API.

I only have a 1.2 Mbit ADSL line so the limitation could be on my end. It's not clear what the limitation is on the IB if there was a "big pipe" on the trading system side. However, regardless of how large the pipe, routing over the Internet is, by design, non-deterministic. IB also supports dedicated T1 lines support, either through Radianz or Savvis.

BT Radianz is the leading provider of secure, reliable, and scalable connectivity to the global financial community. The company's shared market infrastructure is a neutral platform that provides turnkey access to a broad array of pre-trade, trade, and post-trade applications from leading content and service providers across the straight-through processing (STP) chain.

SAVVIS, Inc. (NASDAQ: SVVS) is a global IT utility services provider that leads the industry in delivering secure, reliable, and scalable hosting, network, and application services. SAVVIS' strategic approach combines the use of virtualization technology, a utility services model, and automated software management and provisioning systems. SAVVIS solutions enable customers to focus on their core business while SAVVIS ensures the quality of their IT infrastructure. With an IT services platform that extends to 45 countries, SAVVIS is one of the world's largest providers of IP computing services.

IB will also support a direct leased T1 line into the IB data center.

IB connectivity possibilities are shown below:


Diagram from from here (PDF format).

Transaction Rates

IB transaction either go through the TWS (trading software), the API (in this case Java) or through CTCI FIX. A single account (user name and password) is limited to 50 messages a second (see this page). The relationship between messages and order transactions is not clear.

The IBGateway client allows for FIX CTCI connections to IB over the Internet. It is a piece of software that acts as a bridge between your FIX engine and IB.

Using the CTCI FIX interface the limit is 150 messages a second. This requires a FIX "engine" (normally called a client) to provide the API for the FIX protocol. The FIX protocol appears to be extremely complex and apparently not every broker system or exchange supports it in exactly the same way. Implementing a client API for this protocol would be time consuming and expensive. Fortunately, Java FIX "engines" can be purchased from several sources, including:

IB API Based Applications

To connect to IB the TWS (Trading Work Station?) application must be run first. One Java API application can connect to one TWS process. The connection takes place via a network connection. If the TWS and the API application run on the same system this network connection will be through localhost. This is rather awkward, since trading program execution requires TWS to be run first to establish a session (via user name and password).

IB Discussion Boards

IB Tick Data Feed

The IB API supports a tick data feed. Each stock must be requested and there is a single interface in the API that receives the tick data. This data stream must be "demultiplexed" into a stream for each stock. IB does not provide a true market data feed, but rather a consolidated data feed with about one value per 250 msec. For many trading applications this is sufficient. Better data feeds are available, but they are expensive, at least for a professional quality feed.