MatLab Trading toolbox - and IB TWS

16 次查看(过去 30 天)
Andrew J
Andrew J 2017-3-8
Is it safe to assume that the latest version of TWS together with the latest version of the IB API should be compatible with Trading toolbox 2016b ? - I cannot get the latest version of IB TWS to work with MatLab 2016b 'out of the box'.
I have MatLab 2016b (64 bit) (9.1.0.441655) including the Trading Toolbox - but which version of the IB TWS / API is this version of the Trading toolbox meant to work with ? The documentation states:
"Note: IB Trader Workstation versions 9.69 and 9.7 and later are supported."
However if that is taken literally - then how can it be correct ? - given that the 'latest' version of TWS from the IB website is currently version: 963.2d - and allowing for a shift in dp for major/minor versioning - this doesn't make much sense. However - if this refers to the API version, then the latest version of that seems to be 972.18.
The problem that I am seeing is that the line of code:
ib = ibtws('',7496);
produces the error:
Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'.
Having done a registry search - the key 'TWS.TwsCtrl.1' doesnt appear to exist, but 'TWS.TWSCtrl' does - so I wondered if 2016b was actually compatible with an earlier TWS api version - which probably shouldn't be the case - given the 'and later' in the above documentation. However, I cant find anywhere that you can download earlier versions of the TWS API - so I cant test this idea right now, or get anything to work. I have already checked the correct MSVC++ runtimes etc are installed.
Also - the example stand-alone apps which are distributed with the TWS API do work - which shows that the TWS API is functioning, and suggests a problem on the MatLab side - or a compatibility issue between them.
Hence the question about what versions are supposed to be compatible - right now it just doesn't work 'out of the box'.

回答(2 个)

Kawee Numpacharoen
The latest version of IB API may not support 64-bit MATLAB. You may need to get the older version of IB API (for example version 9.71). Here are the steps for getting it:
  1. Navigate to http://interactivebrokers.github.io/
  2. Accept the License Agreement.
  3. Copy the Link for a Windows API download
  4. In the copied URL, change the ending ‘20xxx.xx.msi’ to ‘20971.06.msi’ and paste it in the address bar.

Yair Altman
Yair Altman 2018-1-12
Version 9.69 refers to the IB API version, not the TWS version. As of this moment, the latest version of the IB API is 9.73, which was just recently released, on Dec 28, 2017.
Sometime in recent years, presumably around API version 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

类别

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