IB API


IB API Software

Program traders may build their own add-on applications in Excel (using DDE or ActiveX), C++, Posix C++, Java, and Visual Basic with our proprietary IB Application Program Interface (API), which requires connectivity via either the TWS or the IB Gateway. We encourage API users to test their API components with their PaperTrader or the TWS Demo System before actually implementing any new API systems.

 
Windows
Windows Beta
MAC/UNIX
MAC/UNIX Beta
Software Download latest version Download beta version Download and Installation Instructions for MAC Download and Installation Instructions for UNIX Download and Installation Instructions for MAC Download and Installation Instructions for UNIX
Downgrade to previous version
Release Date
Jun 12 2009
May 05 2010
Jun 11 2009
May 05 2010
Version
API 9.63
API beta 9.64
API 9.63
API beta 9.64
Special Notes
Includes the C++ Socket, Java Socket, DDE, Active X APIs, and sample code for each.
Includes the Java Socket API, Posix C++ Socket API and sample code for each.
Support API Reference Guide or IB Discussion Forum.

As a reminder, the use of the IB API as a means of disseminating information, including market data or any other licensed or copyrighted information, to third parties or non-registered IB customers is strictly prohibited without prior written approval of Interactive Brokers.

Connectivity

The IB API must use an Access Method (either TWS or the IB Gateway) before it can connect to the IB trading system through one of the available Connection Types described below.

If you prefer quick access to the latest production version, log in to the browser-based TWS or IB Gateway, which you access from the Login command on the menu above. If you prefer to upgrade manually to ensure that your API works with a specific version of TWS or the IB Gateway, download the standalone version(s) below to your desktop.

Browser Based Logins Standalone Downloads
IB Gateway IB Gateway for Windows
IB Gateway for UNIX
IB Gateway for MAC


Access Method Comparison
You can log into either interface at any time with no repercussions. You may want to use TWS for testing, and subsequently run the IB Gateway to conserve system resources. Both access methods are upgraded synchronously and provide the same features; the primary difference is that the IB Gateway has no graphical user interface (GUI).

Feature
TWS
IB Gateway
Provides a GUI that allows you to see and manage API orders.
Yes
No
Must remain running to maintain access to IB trading system.
Yes
Yes
Can be logged in to from the IB web site Login menu (always latest version) or downloaded as a standalone version.
Yes
Yes
Can also be used as a connection interface for the FIX CTCI API.
No
Yes
GUI-less interface runs more efficiently and uses fewer system resources.
No
Yes

Connection Types
Only one type of connection may be used for each account (account types with multiple accounts, such as advisors, may only have one connection type for all accounts). Switches in connection type can take up to a week.

Connection Type
Access Method
Required?
Description
Internet
Yes
Standard connection through public internet.
Extranet
Yes
A T1 line routed to one of IB's extranet providers, Radianz TNS or Savvis. They route directly to IB over a secure private line.
VPN
Yes
IB supports a dedicated Virtual Private Network (VPN) tunnel from the client's data center directly to one of IB's Data Centers. A VPN provides a secure method of connecting over the public Internet without the need to maintain a dedicated leased line or extranet connection. Unlike the IB Gateway client, the VPN does not require daily manual authentication.
Dedicated Line
Yes
Client pays for a T1 line that connects directly to one of IB's Data Centers, which are located throughout the world. A dedicated lease line connects users directly into the IB system and facilitates a quicker and more secure connection than a regular Internet line.
For monthly minimums per connection type, see the Required Minimums page, Connection Minimums tab.

Individuals and Non-pro advisors who require Extranet, VPN, Dedicated Line, or CTCI integration should send a request to tac@interactivebrokers.com. Pro Advisors, Institutions, and Brokers requiring integration should contact their sales representative. Integration can take up to a week.

The TWS API Getting Started Series

 

The API Getting Started series provides an introduction to the TWS APIs, and is written for programmers who are interested in learning about the functions and features of our API platforms. These publications do not teach programming languages, but are designed to guide the programmer through the basics of the TWS API sample applications.

For information on the TWS API platforms, see the API Release Notes, the API Reference Guide, and register for our live API webinars.

 


The TWS DDE for Excel API

Getting Started with the TWS DDE for Excel API book explores the most user-friendly of the API-supported platform. It is written for non-programmers who have some trading knowledge and are comfortable with Microsoft Excel®. This book walks you step-by-step through downloading the API software and sample spreadsheet, connecting to TWS, accessing the task-specific Excel tabs, and programming some basic VBA macros to customize your application. VBA samples for the book are also available below.

The DDE for Excel API Quick Reference provides an overview of the DDE for Excel API.

Getting Started with the TWS DDE for Excel API
VBA samples for Chapter 22
DDE for Excel API Quick Reference

 

The TWS Java® API

Getting Started with the TWS Java API walks you through our Java API and the Java API sample application. In order to get the most out of this book, you should have some experience with the Java programming language.

The Java API Quick Reference provides an overview of the TWS Java API.

Java API Quick Reference
Getting Started with the TWS Java API
Java API Samples for the Getting Started Guide

 

The TWS ActiveX API

Getting Started with the TWS ActiveX API walks you through our ActiveX API and the ActiveX API sample application. In order to get the most out of this book, you should have some experience with the Visual Basic programming language.

The ActiveX Quick Reference provides an overview of the TWS ActiveX for Visual Basic / VB.NET API.

ActiveX API Quick Reference
Getting Started with the TWS ActiveX API

 

The TWS C++ API

Getting Started with the TWS C++ API walks you through our C++ API and the C++ API sample application. In order to get the most out of this book, you should have experience with the C++ programming language.

The C++ API Quick Reference provides an overview of the TWS C++ API.

C++ API Quick Reference
Getting Started with the TWS C++ API


 

Sun, the Sun logo, Sun Microsystems, Java, and all Java-related trademarks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Microsoft Excel is a registered trademark of Microsoft Corporation in the United States and/or other countries.

API Reference Guide

Use the online version of the Reference Guide to take advantage of the index and other navigational features, and to print individual topics. Use the printable version to print multiple topics or the complete API Users’ Guide.

 

API Release Notes

Click on a build number or topic in the table to access the associated Release Notes. Notes for the most recent build are listed first.

Build
Release Topics
Date
April 21, 2010
June 08, 2009
January 20, 2009
August 12, 2008
April 7, 2008
December 13, 2007
October 29 , 2007
July 13, 2007
May 8, 2007
December 7, 2006
July 19, 2006
November 28, 2005
October 28, 2005
March 18, 2005
Feb 17, 2005
June, 2004
May 26, 2004
September 2003
June 10, 2003
May 22, 2003
February 25, 2003
December 16, 2002
October 30, 2002
October 7, 2002
API Beta Notes

The modifications below are in build 9.64 of the TWS API. Please note that all the enhancements for release 9.64 require the minimum server version 48 (TWS version 905).

For clarification on any of the items listed, refer to the appropriate section in the API Reference Guide, or send us an email at Beta Support.

Enhancements
Request Market Data and Place Order by conid

You can now request market data and place orders from the API using the conid, the unique contract identifier. Previously, the conid could only be used for contract details.

This enhancement applies to the ActiveX, C++ and Java APIs.

Bond Bid/Ask/Last Yield

API market data requests for bond contracts now return values for askYield, bidYield and lastYield.

This enhancement applies to the ActiveX, C++ and Java APIs.

New Request for Implied Volatility

A new API request, calculateImpliedVolatility, calculates the Implied Volatility based on the user-supplied option and underlying prices.

calculateImpliedVolatility(int reqId, Contract optionContract, double optionPrice, double underPrice)

where

  • optionContract is the option contract.
  • optionPrice is the price of the option.
  • underPrice is the price of the underlying of the option.

The calculated implied volatility is returned by tickOptionComputation( ) in a new tick type, CUST_OPTION_COMPUTATION, which is described below.

This enhancement applies to the ActiveX, C++ and Java APIs.

New Tick Type

A new tick type has been added to the API:

  • CUST_OPTION_COMPUTATION - returns calculated implied volatility as a result of an calculateImpliedVolatility( ) request.
    Tick Value 53, returned by tickOptionCompution( ).

This enhancement applies to the ActiveX, C++ and Java APIs.

Tick Types Now Return Greeks, Underlying Price, Model Implied Volatility, Stock and Option Reference Price

The following tick types return values for the Greeks (delta, gamma, vega, theta), the underlying price, pvDividend and the stock and option reference price when requested:

  • BID_OPTION_COMPUTATION
  • ASK_OPTION_COMPUTATION
  • LAST_OPTION_COMPUTATION
  • MODEL_OPTION_COMPUTATION

MODEL_OPTION_COMPUTATION also returns model implied volatility.

This enhancement applies to the ActiveX, C++ and Java APIs.

 

© 2001 - 2010 Interactive Brokers LLC. All rights reserved. Sun, Sun Microsystems, the Sun Logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Excel is a trademark or registered trademark of Microsoft Corporation in the United States and/or other countries.

Implementation of the OCC Option Symbology Initiative (OSI)

The OCC’s Option Symbology Initiative (OSI) will replace the 5-character OPRA code with a 21-character OSI identifier to be used by the exchanges, the OCC, and OPRA in all of their systems related to order routing, clearing, and market data distribution, respectively. For more information and details, see the Symbology Initiative section of the OCC website.

This page documents the methods and formatting IB will require from its CTCI clients to accommodate this change. Please note that IB's formatting requirements may differ from those of other brokers. Effective February 12, 2010, IB customers who route US listed options orders to IB via FIX, or who receive real-time drop-copy reports via FIX, will need to have modified their systems.

IB CTCI customers who route US listed options orders to IB via CMS will be required to migrate to FIX in order to comply with the OCC initiative. In preparation for this conversion, mandatory industry-wide testing is scheduled for September 2009. IB requires that its CTCI clients complete FIX certification testing by the end of November 2009. The Interactive Brokers Client Integration Group has created this document to assist you in modifying your interface.

To schedule mandatory interface testing, and for answers to your OSI questions, contact the Interactive Brokers Client Integration Group at ci@interactivebrokers.com.

OSI Symbology Key

The 21-character OSI identifier comprises six data elements arranged in logical order, each with a minimum field size. The Symbology Key defines each of the data elements, and shows the minimum data set required for transmission of listed options contracts between exchanges, the clearinghouse and their constituents.

Table 1: Symbology Key Examples

5-character OPRA Code
21-character OSI Identifier*
OSI Data Elements (minimum field size)
Option Root
Symbol
[6]*
Yr,
[2]
Mo,
[2]
Day
[2]
C/P
[1]
Dollar
Strike
[5]
Decimal
Strike
[3]
SZVXI SPX    111216P01900000 SPX 11 12 16 P 01900 000
WMFAW MSFT  100116C00047500 MSFT 10 01 16 C 00047 500

*If the Option Root Symbol is less than 6 characters, spaces are added to equal the six character minimum.


Client Order Routing via FIX

Maturity day is now required for order routing to resolve ambiguity in the event that more than one expiration date occurs within the same month for an option class. Note that under the OSI, a single option root symbol, in most cases the underlying symbol, will serve as a container for all series on an underlying, including the regular expiration, weekly expiration and end of month expiration contracts. This is significantly different (and more intuitive) than the old methodology in which a new option root symbol was assigned for each expiration cycle.

To accommodate these changes, clients will be required to either:

  • Send tag 205 (Maturity Day) to specify expiration day for derivatives along with standard tag 200 (Maturity Month/Year) which is already required, or
  • Send tag 541 (Maturity Date) which includes month, year and day in YYYYMMDD format.

Clients routing multi-leg orders must include tag 611 (LegMaturityDate) in place of tag 610 (LegMaturityMonthYear) once for each option leg.


The table below describes how the three available routing methods will need to be handled with the implementation of the OSI :

Current Routing Method
Under the OSI
Option root symbol (a.k.a. trading class) plus option parameters including right, maturity month/year and strike. Option symbols will no longer be different for short term options and standard monthly options on the same underlying. Customers employing this method of order routing will have to change their interfaces and send new option symbol in addition to maturity day via tag 205, or 541 to uniquely identify tradable option contracts.
Underlying symbol plus option parameters including right, maturity month/year and strike. Customers employing this method for order routing will need to include maturity day via tag 205, or 541 to avoid potential ambiguities.
OPRA code. This method currently requires customers to send a 5-character OPRA code. Customers employing this method for order routing will need to send the new 21-character OSI identifier instead of the 5-character OPRA code.

 

Client Order Routing via CMS (Common Message Switch)

As the CMS protocol does not comply with the OSI, IB will not support CMS interfaces for US listed options routing beyond the OSI implementation date. Customers will need to replace CMS order routing with FIX order routing.


Real Time Reporting via FIX

Real Time Trade Reporting (Trade Drop Copy) and Real Time Trade and Order Reporting,(OMS Drop Copy) FIX interfaces used to report US listed option activity will have to be upgraded following the same rules described above in Client Order Routing via FIX. Affected IB clients must be ready to accept tag 205 (Maturity Day) in addition to option (or underlying) symbol and option parameters, and clients who rely on the 5-character OPRA code to identify options will need to be ready to accept the 21-character OSI identifier.