Matlab and Interactive Brokers

8 次查看(过去 30 天)
Pierre-Eric Lys
Pierre-Eric Lys 2018-3-23
I am using Matlab 2017b on a MacBook Air, MacOs Sierra 10.12.6 I am trying to connect to Interactive Brokers TWS API but I get an error message Error using actxserver (line 90) Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'. Error in ibtws
I have tried installing various versions of TWS but none are working. Any help would be useful. Thanks in advance

回答(2 个)

Guillaume
Guillaume 2018-3-23
编辑:Guillaume 2018-3-23
On a Mac? If that's the error message you get on a Mac then it's a very misleading error message!
The technology used by actxserver (COM: Component Object Model) is a microsoft design. It is only available on Windows. I know nothing about the IB TWS API but if it requires COM/ActiveX, then it can only be used on Windows.
edit: Just tested on linux and indeed actxserver does return 'invalid progID' instead of telling you that the function simply cannot work on linux/mac. A bit silly really.
  2 个评论
Pierre-Eric Lys
Pierre-Eric Lys 2018-3-23
Thanks Guillaume for your reply. The support team from Interactive Broker indicated that the TWS should be compatible with both Windows and MacOs because it is Java coded. I might simply apply the wrong code, but based on documentation and videos, I first need to ensure connection between the API and matlab by ib = ibtws('',7496) and then ibContract = ib.Handle.createContract etc.. see the video at https://www.mathworks.com/videos/get-started-with-trading-toolbox-connect-to-interactive-brokers-1-of-3-91839.html Not sure what I am doing wrong here.
Guillaume
Guillaume 2018-3-23
Note: I don't have the trading toolbox so all I'm writing is just based on my reading of the online documentation.
It looks like the matlab function ibtws does the communication to the API exclusively throught activeX (since one of the property is a COM interface handle). So even though the API may be accessible directly through Java, the way mathworks have coded it, it requires ActiveX which means it's windows only.
It's a bit puzzling why it's not explicitly listed in the documentation itself, but looking at the product requirements for the trading toolbox it does say that IB support is Windows only.
Since the API is Java, you could interact directly with it from matlab through Java code, but you'll be essentially reimplementing the matlab toolbox yourself.

请先登录,再进行评论。


Yair Altman
Yair Altman 2018-3-24
Trading Toolbox support for Interactive Brokers is limited to Windows only. This is clearly mentioned in the documented system requirements. On Mac & Linux you will see the error that you mentioned because these OSes don't support COM/ActiveX, on which the Trading Toolbox connector to IB is based. You might be able to run it using Windows emulators such as Parallels or Wine.
If you need a native Matlab-IB connector on Mac or Linux, try my IB-Matlab toolbox instead: http://undocumentedmatlab.com/ib-matlab. IB-Matlab is based on IB's Java (not COM) API, so it runs well on all platforms that support Matlab: Windows, Mac and Linux.
IB-Matlab is available since 2010 and was installed by thousands of traders over the years. It is, by far, the highest-rated product on IB's Product Marketplace.
Yair Altman

类别

Help CenterFile Exchange 中查找有关 Transaction Cost Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by