issue retrieving data from interactive brokers

6 visualizaciones (últimos 30 días)
philip curran
philip curran el 10 de En. de 2022
Respondida: Shivam Lahoti el 3 de Nov. de 2023
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.

Respuestas (1)

Shivam Lahoti
Shivam Lahoti el 3 de Nov. de 2023
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.

Categorías

Más información sobre App Building en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by