Access market/portfolio data and submit trade orders in Matlab via Interactive-Brokers (IB), using the IB-Matlab application.
IB-Matlab provides an easy-to-use Matlab interface to InteractiveBrokers, enabling quants, traders and ordinary folk to easily leverage Matlab’s superior analysis and visualization capabilities, with the IB low-cost trading platform for stocks, ETFs, mutual funds, bonds, options, futures, commodities and Forex. IB-Matlab can be used for both automated algo-trading and selective manual trading, as well as continuous market data feed; it is actively used by hundreds of financial institutions and individuals worldwide.
While IB’s Java connector, which is provided by IB, can be used directly in Matlab, setting up the event callbacks and data conversions between Matlab and the connector is definitely not easy. You need to be familiar with both Matlab AND Java, at least to some degree.
Other applications that solve these problems are either expensive, not supported, or limited in functionality or deployment. For example, ActiveX solutions only work properly on 32-bit Windows and even then lose some events and are relatively slow. matlab2ib quant2ib
IB-Matlab solves the IB-to-Matlab connectivity problem with an easy-to-use Matlab interface that works out-of-the-box on all Matlab platforms (Win32, Win64, Mac, Linux). IB-Matlab enables Matlab users to leverage the IB platform to:
- query current market data (quotes and contract info) in snapshot or streaming modes.
- query historical and intraday market data, using IB as a data-feed provider.
- retrieve the current portfolio contents, balance, P&L, margin and other IB account values.
- place scanners that filter the market for securities that match certain criteria.
- place trading orders for multiple security types and trading parameters on dozens of exchanges worldwide.
- monitor open trade orders and executions (partial/full).
- attach user-defined Matlab callback functions to ~40 data events sent by IB (trade executions, real-time tick data etc.)
- combine all of the above for a full-fledged end-to-end automated trading system using plain Matlab.
IB-Matlab outshines the alternatives in terms of performance, reliability, features, stability, deployment, compatibility, cost and overall value. Don’t take our word for it – request your fully-functional free trial today, and check for yourself!
Main features of IB-Matlab
- Full solution – IB-Matlab is an inexpensive application that enables simple Matlab access to the entire IB API functionality.
- Connectivity – IB-Matlab enables users to connect Matlab to TWS or the IB Gateway, on the Matlab’s computer or on a different computer.
- Stability – IB-Matlab has been installed, tested and used by hundreds of traders since 2010. IB-Matlab is reportedly used to actively trade $100 million daily. It is rock solid.
- Inexpensive – IB-Matlab provides excellent value compared to other connectors of its kind or to the amount of time that would be needed to develop a similar robust connector from scratch. A fully-functional free trial version is available (see below).
- Easy to use – Users can activate IB’s API by simple Matlab commands, without any need to know Java (on which the API is based) nor Matlab programming. IB-Matlab simplifies the IB API in a very easy-to-use yet powerful interface that can be used by any Matlab user, novice or advanced.
- Entire API functionality –
- Active trading actions: buy, sell, short, close, modify, cancel, exercise, lapse
- Numerous settable contract and order attributes
- Market query actions: current market data, scanner filter, streaming quotes, real-time bars, snapshot and streaming market depth, historic and intraday data, contract details, options-chains
- Account query actions: account info, portfolio list, open orders, executions data
- IB events: all ~40 asynchronous events that are sent by the IB server are accessible in Matlab (see below)
- Novice and advanced users – Users can use either simple one-line Matlab commands, or internal objects exposed by IB-Matlab, to access the full range of IB’s API.
- Multiple (FA) accounts – Financial advisors can easily manage multiple IB accounts from a single Matlab session/script, including portfolio queries and routing trade orders to FA profiles/groups.
- Remote access – IB-Matlab can be installed on the same platform as TWS, or on a separate machine that connects to the IB client remotely.
- Event callbacks – Users can easily attach Matlab code (callbacks) to IB events. For example, this enables adding an entry in an Excel file, or sending an email/SMS (text message), whenever a trade order executes, or a specified price is reached.
- Additional functionality – IB-Matlab also provides functionality that is not readily available in the basic IB API: the ability to specify automated trading; specifying custom trades such as brackets or combo spreads; automatically changing unfulfilled limits based on the momentary bid/ask prices; and changing order types at a certain time.
- Compatibility –
- Platforms: IB-Matlab works on all platforms on which Matlab runs: Windows (both 32 and 64 bits), Mac, Linux/Unix.
- Matlab: IB-Matlab works on all Matlab releases since 2006, including the latest release (R2016b).
- IB clients: IB-Matlab works with both Trading WorkStation (TWS) and the IB Gateway.
- IB API: IB-Matlab works with all IB installations since 2009, including the latest IB API (9.72), and the latest IB clients. Other IB configurations are also generally supported.
- Security – IB-Matlab does not transmit any information externally except to IB, so your portfolio and trading information are as safe as your own computer.
- Performance – IB-Matlab is optimized for performance, providing fast and responsive connectivity. While Matlab as a platform is not well-suited for HFT, IB-Matlab still enables placing multiple requests per second, and receiving dozens of streaming quotes or other IB messages per second.
- Development – IB-Matlab was developed by an acknowledged Matlab expert, who wrote the reference textbooks on Matlab-Java interfacing and Matlab performance.
- Support – Custom development and ongoing support is available directly from the developer, with extremely fast response times.
- Documentation – Extensive and comprehensive documentation, with numerous code examples and usage tips (see below).
- Client base – IB-Matlab is actively used by many hundreds of traders worldwide, ranging from individual traders, to hedge funds and banks.
- Backtesting – IB-Matlab does not include backtesting functionality, but can integrate with the WFAToolbox backtesting and analysis application, in order to develop, test and deploy trading algorithms, all within the Matlab environment.
No other solution provides this rich set of features – not even close (see comparison). Don’t take our word for it – get your free trial and check for yourself. You will not be disappointed.
- Quick-reference help
- Full User Guide (PDF)
- Usage syntax details
- Usage examples
- Questions & Answers
- Real-time trading system demo that uses IB-Matlab, presented at the MATLAB Computational Finance Conference in New York in May 2013, and at the MATLAB Computational Finance Virtual Conference in Sep 2013 (presentation slides, demo source-code, webinar video).
- Two reviews of IB-Matlab were published in the Automated Trader magazine (2011, 2012). The full reviews (PDF) are available for download here (2011, 2012) – see excerpts below.
- User testimonials – see below
- IB’s online API Guide
So, do we like it? Well, IB-MATLAB is robust, very easy to learn how to use and does exactly what it claims to do – namely provide a simple and efficient order interface between MATLAB and Interactive Brokers’ API. It also costs peanuts…
So yes, we like it – a lot.
All told, we regarded the enhancements to IB-MATLAB since we last reviewed it as significant. The order submission process was rock solid as before, but the new capabilities really open up the possibilities – especially for trading that is analytically intensive but not high frequency. We were able to deploy multiple models in real time to IB’s trading platform without any difficulties or glitches. …
IB-MATLAB effectively contradicts the declaration we’ve seen on more than a few web sites that “MATLAB is not for real time trading”.
Easy integration with IB through IB-Matlab… The * Toolbox isn’t very robust, it’s really buggy, … I would love to get the * Toolbox up and running, but I think that Yair has got it covered for Interactive Brokers, I just use his program…
IB-Matlab is our wrapper for the IB API, so that we don’t have to write our own Java connector. IB-Matlab is a robust Java connector, complete wrapper for the IB API. A cheap investment, it’s definitely worth it. I can’t even stress enough how much time it will save you. Don’t build from scratch, it is cheaper and faster to buy from 3rd-party vendors. If I was to build IB-Matlab it would take me several weeks and for only $400 I could have a turnkey solution, I mean it’s a no-brainer there… It’s better than those retail trading platforms. This is the cheapest professional-grade system that you can get. IB connected to IB-Matlab connected to Matlab connected to the Data-Feed Toolbox connected to IQFeed is the cheapest technology stack that will give you trading robustness.
Yair is extremely helpful, provides great customer support.
– Chris Reeves, A2X Capital, Feb 27, 2015 (“Algorithmic Trading System” video)
Also quoted: IB-Matlab is the most robust wrapper for the IB API I have come across. Amazing value for the price!
– creeves, Feb 23, 2015 (comment posted about IB-Matlab on IB’s Marketplace)
…At that point I turned to Yair Altman’s IB-Matlab product. Happily, this uses IB’s Java api, which is a great deal more robust than the ActiveX platform. It’s been some time since I last used IB-Matlab and was pleased to see that Yair has been very busy over the intervening period, building the capabilities of the system and providing very comprehensive documentation for it. With Yair’s help, it took me no time at all to get up and running and within a day or two the system was executing orders flawlessly in IB’s TWS. …
Yair is very generous with his time in providing support to his users and his responses to my questions were fast and detailed.
– Jonathan Kinlay, Quantitative Research and Trading, March 5, 2015 (“Algorithmic trading” article)
The following testimonials appear on IB’s Marketplace, where IB-Matlab is the top-rated product, with a perfect score of 5.000 stars from dozens of traders:
All these quotes are from real IB traders, who took the time to comment about IB-Matlab on IB’s website. Numerous other traders have provided similar statements by email.
In addition to the quoted testimonials above, all traders rated IB-Matlab with a perfect 5-star rating – not even a single trader has voted Matlab with a lower vote. This perfect score of 5.000 stars from dozens of traders is unparalleled by any other program on the IB Marketplace. We take great pride in providing a great product, exceptional value, and excellent customer service.
Don’t take our word for it – try it out for yourself!
Pricing and support
|License type||# of computers||License duration||License cost||Renewal cost||Remarks|
|Free trial (see below)||unlimited||2 weeks||Free||Not available||No extension or renewal|
|Commercial (standard)||unlimited||1 month|
|Commercial (EZ-pay)||1||3 months|
|See note #2 below|
|See note #3 below|
|Volume (multi-computer)||flexible||flexible||Contact us||Contact us|
|Deployment (compiled or OEM)||unlimited||flexible|
|Custom feature development||unlimited||unlimited|
|Custom trading-program development||unlimited||unlimited||some examples|
- The Commercial and Academic licenses are limited to a single user on a single physical computer.
- The EZ-pay license can be converted to a standard Commercial license of the same duration, for a one-time cost of $150.
- The Academic license is only available to users having an active academic institution email address that ends in .edu or .ac (for example, firstname.lastname@example.org, email@example.com).
The Academic license can be converted to a standard Commercial license of the same duration, for a one-time cost of $200.
- The license cost includes installation support, fixing bugs, and any fixes that may be required due to IB API changes.
- The renewal cost includes installation of the latest version of the product available at the time of renewal. Renewal is always to the same duration term as the original license purchase.
- Prices are subject to change from time to time.
- Payment is processed via PayPal (a PayPal account is not required). Contact us if you wish to pay via wire (bank) transfer.
Free trial version
Request a trial and get a no-obligations copy of IB-Matlab with detailed installation and usage instructions. There are absolutely no strings attached: the trial is completely free and fully functional, just limited in duration (about 2 weeks). The trial starts the moment that you request it; you will receive download and installation instructions to your specified email.
You only need the basic Matlab, no toolbox is required. You can be up and running within minutes. We are confident that you will love the product, so we encourage you to test it:
THIS SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, LOSS OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE — USE OR OTHER DEALINGS IN THE SOFTWARE.
(detailed disclaimer is available in IB-Matlab’s User Guide)