ConnectToI​BTWSOnLoca​lMachineEx​ample not working

조회 수: 4 (최근 30일)
JAY CAMERON
JAY CAMERON 2019년 9월 23일
답변: Kajal Bansala 2021년 3월 10일
I have read some comments about problems like this and I still don't know what to do.
My Activex Socket Clients are enabled. My Socket port is 7496. I can access with IBMatlab.
I am running with Windows 10 64bit.
I have the latest version of TWS.
I get the error using the test program "ConnectToIBTWSOnLocalMachineExample"
Error using actxserver (line 93)
Server creation failed. Invalid ProgID 'TWS.TwsCtrl.1'.
Error in ibtws (line 37)
x.Handle = actxserver('TWS.TwsCtrl.1');
Error in ConnectToIBTWSOnLocalMachineExample (line 7)
ib = ibtws('',7496)
My ver
MATLAB Version: 9.7.0.1190202 (R2019b)
MATLAB License Number: 40386371
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 18985)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.7 (R2019b)
Curve Fitting Toolbox Version 3.5.10 (R2019b)
Financial Toolbox Version 5.14 (R2019b)
IB-Matlab - Matlab connector to InteractiveBrokers Version 2.05 Expires: 1-Oct-2019
Optimization Toolbox Version 8.4 (R2019b)
Parallel Computing Toolbox Version 7.1 (R2019b)
Statistics and Machine Learning Toolbox Version 11.6 (R2019b)
Trading Toolbox Version 3.6 (R2019b)

답변 (2개)

Annie Leonhart
Annie Leonhart 2019년 12월 1일
You're running the latest version of Matlab which corrected this issue. I assume you are not running the latest API from TWS. It doesn't matter if you have the latest TWS platform, you need the latest API which is 9.76
Download: here

Kajal Bansala
Kajal Bansala 2021년 3월 10일
Hello,
This error indicates that the Trading Toolbox in MATLAB cannot establish a connection to the IB Trader Workstation ActiveX-based API. Please refer to the following MATLAB Answers post for some initial troubleshooting steps that may help resolve the error experienced:
If after following the above post, you are unable to get "success" message from Excel VBA and hence getting connection error in MATLAB, there is something broken with the IB Trader API installation. It would be best to contact the IB support since the VB script is checking connection outside of MATLAB and the resulting error is not caused due to MATLAB.
Additionally, I would suggest to first (before reaching out to IB) try the suggestions as per the following MATLAB Answers post linked below as other users came across the same issue and have received next steps from IB:
The BaT file provided by IB helps establish connection with Excel using DDE connection and not ActiveX API connection which is used by MATLAB.
In order to instantiate the connection between IB and MATLAB, the system needs to recognize the ActiveX API program ID TWS.TwsCtrl.
The VB script won't run because it can't find the Trader Workstation program ID. And since the VB Script is not running, this indicates that there is something going wrong with the IB installation files. I would recommend contacting the IB Support for help troubleshooting the IB installation files.
As a possible workaround to connect IB with MATLAB, you could use the IB MATLAB product by Yair Altman.
Please find the below link for more details about IB MATLAB:

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by