MATLAB Answers

Interactive brokers(TWS) current version not working with MATLAB?

5 views (last 30 days)
Arm Dan
Arm Dan on 2 Aug 2018
Edited: Allan MacLeod on 10 Nov 2018
I have tried to use the ibtws function in order to make a connection between MATLAB and TWS. I got the following error:
Error using actxserver (line 90) Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'.
Error in ibtws
I then tried to fix this by looking at some potential fixes that I found on this forum, but nothing seemed to work, I kept getting the same error. After that, I looked further and I found something which said that the current version of TWS simply can not be connected to MATLAB. Is this true? And is there something you can do about it?

  1 Comment

Allan MacLeod
Allan MacLeod on 10 Nov 2018
Hi, if you're still working on this there was an update to MATLAB that solved the problem. TBC as the activeX error is gone however I still can't get it working.

Sign in to comment.

Answers (1)

Yair Altman
Yair Altman on 3 Aug 2018
Edited: Yair Altman on 3 Aug 2018
Sometime in recent years, presumably around TWS API 9.70, IB changed their COM server's ProgID from 'TWS.TwsCtrl.1' to 'TWS.TwsCtrl'. This breaks the Trading Toolbox code, which assumes a ProgId of 'TWS.TwsCtrl.1'. Since the Trading Toolbox's code is encrypted, you cannot modify its expected ProgId. The best you could do is to try to uninstall your API and install an old version (possibly with the assistance of IB). Note that this might break other things for you - the old API version might not be fully supported by IB today, but it's worth trying. And of course you could report this to MathWorks and hope that a fix or workaround will be provided in some future release.
Another potential reason might be if you're running on Mac or Linux: 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, on which the Trading Toolbox connector to IB is based.
You can try my Java-API-based connector ( IB-Matlab ), which does not rely on COM and does not exhibit the COM interface's problems. The reliance on Java also means that IB-Matlab works on all Matlab releases since 2008, all Matlab platforms (MacOS, Linux, Windows), and all IB API versions.
Yair Altman


Sign in to comment.

Sign in to answer this question.

Translated by