issue retrieving data from interactive brokers

2 views (last 30 days)
philip curran
philip curran on 10 Jan 2022
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'; = '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.

Answers (0)




Community Treasure Hunt

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

Start Hunting!