Introduction of IBridgePy

IBridgePy is a flexible and easy-to-use Python package which talks to Interactive Brokers C++ API. Different from Ibpy, which is a third-party implementation of the API used for accessing the Interactive Brokers (IB) on-line trading system, IBridgePy does not re-implement the API of IB. It only makes a wrapper around IB’s C++ API so that Python can call the C++ API directly. Because IB’s C++ API is an officially maintained by IB, it is unlikely to have unexpected program errors and will be upgraded whenever IB has a new release of its trading system. Because IBridgePy is built on IB’s official C++ API, the users can easily refer to IB’s documentation for each function’s signature and usage. IBridgePy consists of two main parts. One part is the C++ wrapper and the other part is a Python library which includes a lot of API functions similar to Quantopian’s interface, which makes much easier for users to build algorithmic trading strategies if they are familiar with Quantopian. The instructions for installing and using IBridgePy, please see this webpage.

Motivation of the development of IBridgePy

Algorithmic trading has been considered to be complicated and expensive, and is mainly implemented by institutional traders. For example, Elsen provides comprehensive algorithmic trading solutions with API available in all main stream programming languages, but there is a significant cost to use the software. Emerging technologies has brought the barriers of algorithmic trading lower and cheaper than ever. As a good example, Quantopian provides a Python based platform which allow users to backtest and deploy algorithmic trading strategy at no cost (as of 05/03/2015). Quantopian has gained popularity and attracted many people to use the Python based algorithmic trading platform. However, Quantopian has a lot of limitations which are unlikely to be removed shortly. First, Quantopian can trade only equities at the moment, while many traders are interested in Forex, futures, etc. Second, Quantopian has a limited list of Python packages which are allowed to be used and users could not change them easily. Finally, although Quantopian hided many programming complexity from users, it is not trivial to debug when there is a problem because you don’t have access to all the source code and log info. If you have a trading platform similar to Quantopian, you can trade security you want, use any python package that is useful to you, and look as deep as necessary into the source code for debugging, and that is the motivation of IBridgePy.

Features of IBridgePy

Flexible

You can trade Any securities that Interactive Brokers provides using IBridgePy, for example, stock, futures, options, forex and many others.

You can use Any Python packages that you want to use.

You can get Any data sources from anywhere, such as Yahoo and Google.

You can utilize tick based data provided by Interactive Brokers to design complicated trading strategies, even high frequency trading strategies.

Easy-to-use

IBridgePy wrapped up IB API’s complexity behind the scenes and offer you a much simpler solution. You may complete your automated trading strategy within an hour because you don’t need to worry about managing placed trades and pending orders, coding details about requesting historical data and real time quotes, etc. We have taken care of those so that you can focus on developing your strategies.

Privacy

You have 100% control of your strategies because you run your programs on your computer, not other’s platform.

IBridgePy vs. IB’s native Python API

IBridgePy supports both of Python 2.7 and Python 3.x

IBridgePy provides lots of easy-to-use funtions

IBridgePy takes care of account information

IBridgePy manages multiple IB accounts

Advantages of using Python to do trading with Interactive Brokers

Compared with C++ and Java, Python lets you get most tasks done more easily and more quickly with less mental overhead so that you can try your new trading ideas much faster. Also, You may just simply google the Python packages that you want to use, download and install them, and start to use them in a short period of time because a huge standard library has been built.

Who is Interactive Brokers and why IB?

What is Python?

Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java.

Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). New built-in modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface.

The Python implementation is portable: it runs on many brands of UNIX, on Windows, DOS, OS/2, Mac, Amiga… If your favorite system isn’t listed here, it may still be supported, if there’s a C compiler for it. Ask around on comp.lang.python — or just try compiling Python yourself.

The Python implementation is copyrighted but freely usable and distributable, even for commercial use.