Connecting to Interactive Broker

1 view (last 30 days)
Peter chan
Peter chan on 18 Nov 2016
Commented: Annie Leonhart on 1 Dec 2019
>> ib=ibtws ('',7496) Error using actxserver (line 90) Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'.
Error in ibtws
>>
  4 Comments
christian barbotin
christian barbotin on 16 Oct 2019
Hi
Same for me, do you fing the solution ?
Thanks
Regards
Annie Leonhart
Annie Leonhart on 1 Dec 2019
Items needed to have the toolbox work properly are:
  1. Trading Toolbox 3.5.1+ you can validate by running ver('trading') on Matlab.
  2. IB Gateway or TWS
  3. TWS API 9.76 (latest api)
Please validate you have all those items on the correct version.
If you have Trading toolbox 3.5.1 and Api 9.72, it won't work.
if you have Api 9.76 and trading toolbox 3.4.x it won't work (to my knowledge).
Let me know.

Sign in to comment.

Answers (2)

A.P.
A.P. on 7 Jan 2017
Provided you have the Trading Toolbox, Download and Install IB Gateway, by default the port is 4001, you either use this port in your code:
ib = ibtws ('',4001)
or change the port number in IB Gateway Configuration/Settings/API/Settings/Socket port

Yair Altman
Yair Altman on 12 Jan 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.
Or you can try my Java-API-based IB-Matlab connector which does not rely on COM and does not exhibit any of the problems that are common with the ActiveX/COM-based interface.
Yair Altman

Community Treasure Hunt

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

Start Hunting!