IB-Matlab documentation

Documentation

Click to view the Realtime Trading in Matlab presentation webinar video
Click to view the presentation webinar video

Usage syntax

Click to view the full IB-Matlab User Guide (PDF)
Click to view the IB-Matlab User Guide (PDF)
Multiple usage examples are provided here; many more examples and detailed information are available in the IB-Matlab User Guide.

The general syntax (quick help reference; detailed user guide) is:

[orderId, ibConnectionObject, contract, order] = IBMatlab(varargin)

Possible inputs parameters:

  • varargin = Matlab struct or fieldname/value pairs with the following optional fields:
  • Connection: ClientId, Host, Port, AccountName
  • Contract data: Symbol, LocalSymbol, SecType, Exchange, Currency, Multiplier, Expiry, Strike, Right, IncludeExpired
  • Action: one of Buy, Sell, SShort, Close, Exercise, Lapse, Query, Cancel, Account, Portfolio, History, Realtime, Scanner, Contract, Fundamental, License, or Version
  • Query type: either OPEN [for the list of open orders], or EXECUTIONS [for the list of today’s executions]
  • Order type: one of MKT, MKTCLS, LMT, LMTCLS, PEGMKT, STP, STPLMT, MIT, TRAIL, REL, TWAP, VWAP, GuarranteedVWAP, TRAILLIMIT, etc. – see full list here and detailed explanations here; note that IB prevents some combinations of orders and securities
  • Order data: Action, Quantity, TIF, LimitPrice, AuxPrice, OCAGroup, ParentId, TrailingPercent, TrailStopPrice, GoodAfterTime, GoodTillDate, BracketDelta, BracketTypes, TriggerMethod, OutsideRTH, OrderId, Hold, Timeout, HedgeType, HedgeParam
  • TWAP/VWAP order data: StrategyType, MaxPctVol, StartTime, EndTime, AllowPastEndTime, NoTakeLiq
  • Combo order data: ComboActions, ComboRatios, ComboBagSymbol
  • Automated order data: LimitBasis, LimitDelta, LimitRepeatEvery, LimitUpdateMode, LimitChangeTime, LimitChangeType, Tick
  • Historic/intra-day data: EndDateTime, DurationValue, DurationUnits, BarSize, WhatToShow, UseRTH, FormatDate, IncludeExpired (note IB’s pace limitations)
  • Streaming quotes data: QuotesNumber, QuotesBufferSize, ReconnectEvery, GenericTickList
  • Market depth (order book) data: NumberOfRows, QuotesNumber
  • Scanner parameters: Type, ParametersType, AbovePrice, AboveVolume, AverageOptionVolumeAbove, BelowPrice, CouponRateAbove, CouponRateBelow, ExcludeConvertible, Instrument, LocationCode, MarketCapAbove, MarketCapBelow, MaturityDateAbove, MaturityDateBelow, MoodyRatingAbove, MoodyRatingBelow, NumberOfRows, ScanCode, ScannerSettingPairs, SPRatingAbove, SPRatingBelow, StockTypeFilter
  • Financial advisors: FAProfile, FAGroup, FAMethod, FAPercentage, AccountName
  • Event callbacks: CallbackFunction, CallbackAccountDownloadEnd, CallbackAccountSummary, CallbackAccountSummaryEnd, CallbackBondContractDetails, CallbackCommissionReport, CallbackConnectionClosed, CallbackContractDetails, CallbackContractDetailsEnd, CallbackCurrentTime, CallbackDeltaNeutralValidation, CallbackExecDetails, CallbackExecDetailsEnd, CallbackFundamentalData, CallbackHistoricalData, CallbackManagedAccounts, CallbackMarketDataType, CallbackMessage, CallbackNextValidId, CallbackOpenOrder, CallbackOpenOrderEnd, CallbackOrderStatus, CallbackPosition, CallbackPositionEnd, CallbackTickPrice, CallbackTickSize, CallbackTickString, CallbackTickGeneric, CallbackTickEFP, CallbackTickOptionComputation, CallbackTickSnapshotEnd, CallbackRealtimeBar, CallbackReceiveFA, CallbackScannerData, CallbackScannerDataEnd, CallbackScannerParameters, CallbackUpdateAccountTime, CallbackUpdateAccountValue, CallbackUpdateMktDepth, CallbackUpdateMktDepthL2, CallbackUpdateNewsBulletin, CallbackUpdatePortfolio
  • General: LogFileName, MsgDisplayLevel

IB-Matlab free trial

Outputs:

  • orderId = -1 if unsuccessful, otherwise the ID of the placed order, or data for ‘QUERY’ actions
  • ibConnectionObject = reference of Java object that interfaces with IB
  • contract = object that holds contract info for Buy/Sell actions when Hold=1 (see example 10 below)
  • order = object that holds order info for Buy/Sell actions when Hold=1 (see example 10 below)

Usage examples

Representative usage examples of IB-Matlab are available here. The following examples are available:

  1. Buy a security
  2. Sell a security
  3. Get portfolio data
  4. Get account data
  5. Get market data (snapshot) for a security
  6. Get historic/intra-day data
  7. Get streaming quotes data
  8. Get realtime bars data
  9. Get detailed contract information
  10. Get options-chain information
  11. Get scanner filter data
  12. Access, modify and cancel open orders
  13. Get executions data
  14. Specify event callback – ExecDetails
  15. Specify event callback – TickGeneric
  16. Use the underlying Java connector to cancel or customize an order

Many more examples and detailed information are available in the IB-Matlab User Guide. Contact us if you have any questions.

Reviews and testimonials

Click to view the IB Marketplace

Click to view the IB Marketplace

105 reviews

The following testimonials appear on IB’s Marketplace, where IB-Matlab is the top-rated product, with a perfect rating of 5.000 stars from over 100 independent traders:

  • “Fantastic product that works flawlessly and has saved me a lot of work, time and money on developing my trading systems! well done Yair!” – mdyson
  • “I have been using IBMatlab for some years now and it works flawlessly. Very well documented and excellent technical support. Highly recommended.” – 6315
  • “IB-Matlab provides absolutely impressive functionality, seamlessly connecting the IB’s trading platform with Matlab and letting you focus on trading.” – Aztec
  • “Works flawlessly, well documented. The IB integration from Matlab’s built in Trading Toolbox is terrible, this plugin will have you up and running within minutes” – KagenA
  • “The trading toolbox from Mathworks is a waste of $. Get IB-Matlab instead. Robust, easy to use, that will pay for itself in rapid development.” – MXR64
  • “Exceptional! Product: robust/stable. Provider: responsive with a less than 24 hr turnaround. This system allows any group to leverage algo trading.” – RSRSE
  • “Yair Altman is the author of two treatise-length books on Matlab. This is evident as IB-Matlab corrects many shortcomings of Matlab’s own interface.” – PhiStrat
  • “IBMatlab really simplified the creation of a functional trading system in Matlab, and Yair has been helpful and very responsive on all my questions.” – brianr
  • “Great product that is very stable. The docs are excellent with many examples. Support is top notch as Yair responds quickly to questions.” – cbmitch
  • “Truly solid product. Easy to work with and has all the functionality to smoothly execute our trading, we have not had a single issue with it.” – STCMF
  • “An excellent product with a detailed user guide. Quick and detailed support by its developer, Yair, an expert Matlab practitioner. Highly recommended.” – T_R
  • “Rarely are the claims of a developer so understated. The software is simply a “must have” for IB development within Matlab. Thanks to Yair.” – kvargas
  • “You should charge more for it. Best value for your money. No bugs. Detailed user-guide contains concise explanations. Easy to use and amazing support.” – Constant
  • “This software is a MUST. 15 days trial, EXCELLENT documentation, top notch support, the API is world class design, CHEAP! easy and yet powerful.” – bayes
  • “Very quick response. Support is unparalleled professional quality. Software works great, definitely an easy-to-use tool for making money.” – CLVoting
  • “Highly competent, professional, quick turnaround, in-depth understanding of electronic market micro-structure” – sgoyvote
  • “The software works flawlessly and the support from Yair is unparalleled. Without a doubt worth purchasing.” – asselall
  • “Super. Wasted too much time trying other solutions eg. trading toolbox. IB-Matlab is the way to go. Robust, logical and very well documented.” – jt1010
  • “Excellent connector for MatLab. We evaluated it against the Mathworks product and found Yair’s version far better. We use it on a daily basis.” – AP1234
  • “Great software – very helpful to implement own strategies. Comprehensive and easy to use interface to the API. Yair is very responsive and helpful!” – quantD
  • “Highly recommended product. Easy to use, robust, inexpensive, quick and quality support from the developer. High value product for the money.” – scap
  • “We hired Yair to write some functions for our prop-shop. Got excellent help within 10 hours and he is eager to solve all the things you need.” – johlof
  • “Everyone should buy it. Price is reasonable. I have been using it for three years.” – flash201
  • “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
  • “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
  • “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
  • “Excellent software product, customer support and seamless integration. Totally reliable and a superb addition for automated trading.” – gazza75
  • “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
  • “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
  • “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
  • Professional reviews and additional user testimonials

These quotes are from real IB traders, who took the time to comment anonymously about IB-Matlab on IB’s website using IB’s system. Over 100 traders have anonymously rated IB-Matlab on IB’s website – all of them, without exception, rated IB-Matlab with a perfect 5-star rating. Such perfect rating and superlatives from so many independent traders is unparalleled by any other program on the IB Marketplace. Numerous other traders have provided similar statements about IB-Matlab by private email.

We take great pride in providing a great product, fantastic value, and excellent customer service.

Free trial version

A fully-functional free trial version is available – just request your trial and you will get a no-obligations copy 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:
IB-Matlab connectivity (Matlab and TWS may be on separate computers)

You will receive the trial installation instructions to your specified email within 24 hours. If you do not get an email within 24 hours, then please check your email’s spam folder, or send a direct email to altmany at gmail.com

 Contact us