IB-Matlab: trade with InteractiveBrokers using Matlab

Access market/portfolio data and submit trade orders in Matlab via Interactive-Brokers (IB), using the IB-Matlab application.

IB-Matlab free trialIB-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.

The need

IB-Matlab connectivity (Matlab and TWS may be on separate computers)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 will 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 version today, and check for yourself!

Main features of IB-Matlab

Click to view the full IB-Matlab User Guide (PDF)

Click to view the IB-Matlab User Guide (PDF)

  • 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 over $100,000,000 daily (this is not a typo – USD 100 million). It is rock solid.
  • Inexpensive – IB-Matlab is extremely inexpensive compared to other connectors of its kind and to the amount of time that would be needed to develop a custom application 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, modify, cancel
    • 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 – Users can easily connect to multiple IB accounts from a single Matlab session/script.
  • Remote access – IB-Matlab can either be installed on the same platform as the IB-client, or on a different machine that will connect to the IB client remotely.
  • Event callbacks – Users can easily attach Matlab code (callbacks) to IB events. For example, this enables special operations such as adding an entry in an Excel file, sending an SMS (text message) or email, whenever an order is fully or partially executed, 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 R2006a, including the latest release (R2014b).
    • 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.71), and the latest IB clients. Other IB installations (past and future) are also generally supported.
  • 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.
  • 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.
  • Development – IB-Matlab was developed by an acknowledged Matlab expert, who wrote the textbook bible on Matlab-Java interfacing.
  • 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 hundreds of traders, ranging from individual traders, to hedge funds and banks.
  • Backtesting – IB-Matlab does not include backtesting functionality, but can easily integrate with either WFAToolbox or TA Developer backtesting and analysis applications, which can be used 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.


Click to view the Realtime Trading in Matlab presentation webinar video

Click to view the presentation webinar video

Pricing and support

The license for a single user on a single computer for the first year costs $399. This includes installation support, fixing bugs, and any fixes that may be required due to IB API changes.
Annual renewal (including license, support and maintenance) for each following year costs $99.

To purchase the software license ($399), click here.
You will be taken to PayPal’s secure checkout to complete the purchase.

To purchase the annual renewal ($99), click here.

Contact us if you require any of the following:

  • A fully-functional free trial version
  • Multi-year license
  • Perpetual license
  • Volume (multi-computer) license
  • Deployment (compiled) license
  • Development (source-code) license
  • Custom development of features

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.

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:

Professional reviews

AutomatedTrader magazineSo, 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.

- Andy Webb, Automated Trader magazine, Q3 2011 (online, PDF)

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”.

- Andy Webb, Automated Trader magazine, Q1 2012 (online, PDF)

…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

User testimonials

Click to view the IB Marketplace

Click to view the IB Marketplace

The following testimonials appear on IB’s Marketplace, where IB-Matlab is a top-rated product, with a perfect score of 5.000 stars from dozens of traders:

  • “System has worked flawlessly for the past year. Yair is extremely responsive (I’m not sure when he sleeps) and helpful. Excellent value.” – billj
  • “IB-Matlab is the most robust wrapper for the IB API I have come across. Amazing value for the price!!” – creeves
  • “IBMatlab has been invaluable to test trading strategies; it is reliable and includes lots of useful functions. Yair is very responsive and helpful.” – algo1410
  • “Excellent software – I’ve been looking for something like this for almost a year now. 5/5″ – sysdo
  • “Yair has made a great product and offers valuable support. Good for risk management and data analysis tools and recommend it.” – mkrause
  • “IB-Matlab is an excellent product. It is very solid and Yair is very quick in responding to inquiries. Strongly recommend it !” – FinLab
  • “Support is prompt. Easy to use. Speed is not as quick as I thought. Anyway, it might be due to delay from IB.” – JeffKoh
  • “IB-Matlab provides an excellent range of tools for automated trading systems. Support excellent and prompt. 100% stable in live operation.” – sunbear6
  • “I’ve been using it for over a year and I have no complaints. It is robust and does what it is supposed to do. Very quick customer service.” – hank99
  • “Very helpful interactive link to TWS. Saves hundreds of man-hours in developing custom features.” – cekaulII
  • “I find it quite reliable and easy to use. I was able to code a real time automatic trading system relatively easily. The service behind is excellent.” – khalfina
  • “I have been using IB-Matlab for almost 3 years and have found it to work perfectly. Yair responds promptly to questions with detailed answers.” – kChuck
  • “Amazing product. Running it for last one month. Stable. No instance of breakdown. Mr. Altman is very quick in response time. Highly recommended.” – sujitm
  • “IBMatlab is a very convenient way to access IB’s API. The documentation is comprehensive and it is easy to integrate the software into MATLAB code.” – prateek1
  • “Good tool, good support.” – tal_shir
  • “Excellent product, top-notch tech support.” – nobull
  • “Excellent knowledge on Matlab, Java and IB – perfect for automated trading. It was a real joy and I will work with them again.” – human123
  • “Excellent software product, customer support and seamless integration. Totally reliable and a superb addition for automated trading.” – gazza75
  • “This product is reliable and well documented. The creator is always quick to respond and helpful.” – MacKG
  • “I have been using IB-Matlab for three months now and it has been flawless. Great value.” – wajv
  • “IB-Matlab is an easy to use end-to-end solution for Matlab users.” – BenTam
  • “Excellent. Saves $1600 from Mathworks’ built-in solution.” – muller
  • “A quality product at a good price. I find it to work better and in a more flexible way than Matlab’s own IB toolbox.” – Vasastan
  • “IB-Matlab allows me to perform fully automated trading, using my own developed code. Yair’s support is very professional. I highly recommend it.” – wimvwijn
  • “IB-Matlab is a tremendous product. The documentation is outstanding and Yair is INCREDIBLY responsive to any questions or issues which arise.” – wgpCap
  • “I found Yair Altman readily reachable when I have questions and the product has performed well.” – hwshiau
  • “IB-Matlab lets you harness the depth and efficiency of MATLAB! It’s intuitive, robust, full-featured, and affordable. Great documentation and support.” – JTrade
  • “IBMatlab is a professional Matlab TWS API interface. It works very reliable and is easy to use. The support is very client focused and supportive.” – drepl
  • “Excellent product, responsive support and very useful examples/documentation to get you up and running without much work. Highly recommend!” – CharlesM
  • “Robust product, user-friendly, hard to say no with the price and level of support. Highly recommended.” – stephenw
  • “Great product! Stable platform, very flexible, great support, and easily scaled to implement any automated trading strategy. Well worth the money!” – BenM
  • “Worth every dime and excellent support. The possibilities with the combination Matlab/IB seem limitless. The resulting mac system is extremely stable.” – onmac
  • “Great product that allows one to utilize the power and flexibility of Matlab to create automated systems.” – jbusse00
  • “Good product (IBMatlab): Good range of functionality, Good performance, Good documentation and very good support from Yair.” – unbroken
  • “As a former control system engineer, I used MATLAB. I was very excited to hear about IBMatlab. IBMatlab works! Highly recommend!” – kiscl

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 of whom rated IB-Matlab with a perfect 5-star rating, about a dozen other traders have also voted IB-Matlab with 5 stars, without attaching a comment. 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, fantastic value, and excellent customer service.

IB-Matlab free trial
Don’t take our word for it – try it out for yourself!

Legal disclaimer

(detailed disclaimer is available in IB-Matlab’s User Guide)

Comments are closed.