フィルターのクリア

issue retrieving data from interactive brokers

4 ビュー (過去 30 日間)
philip curran
philip curran 2022 年 1 月 10 日
回答済み: Shivam Lahoti 2023 年 11 月 3 日
i'm using matlab 2021b with the most recent IB TWS, the example code provided by mathworks seems to run fine (no errors are produced), but no data is retrieved from IB.
%% connect to IB TWS
clear all; close all; clc
ib = ibtws('',7497);
%% Create the IContract Object
ibContract = ib.Handle.createContract;
ibContract.symbol = 'MSFT';
ibContract.secType = 'STK';
ibContract.exchange = 'SMART';
ibContract.primaryExchange = 'NASDAQ';
ibContract.currency = 'USD';
d = getdata(ib,ibContract)
%% request last 20 days of data
bizDayConvention = 13; % i.e. BUS/252
currentdate = today;
startDate = daysadd(currentdate,-20,bizDayConvention);
endDate = daysadd(currentdate,-1,bizDayConvention);
%%
histTradeData = history(ib,ibContract,startDate,endDate);
the same problem occurs when trying to retrieve live market data and create orders.
On a seperate note if someone from mathworks sees this, the documentation regarding Interactive Brokers needs updating/more detail adding as there is no documentation provided by IB for MATLAB.

回答 (1 件)

Shivam Lahoti
Shivam Lahoti 2023 年 11 月 3 日
Hi Philip Curran,
As per my understanding, you want to use the ibtws” function. As stated in the question, you are able to extend the connection to IB TWS but facing difficulty while retrieving the data.
Please try the steps mentioned in the answer attached below and observe if it solves your problem. Though it does not throw an error for your connection step, following the mentioned steps might help in retrieving the data, as the answer discusses about using this functionality in releases after r2021a.
Have a look at the references attached below as they discuss the similar issue.
I hope this helps.
Regards,
Shivam Lahoti.

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by