Problem with history function. Trading toolbox
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, I have a problem with Trading toolbox and IBTWS.
I downloaded and installed the TWS API and I can create the ibtws object properly, using the following code:
%% create object
ib = ibtws('',7496);
Then I set up en empty contract structure as follows:
%% set up an empty contract structure
ibContract = ib.Handle.createContract;
ibContract.symbol = 'IBM';
ibContract.secType = 'STK';
ibContract.exchange = 'SMART';
ibContract.primaryExchange = 'IEX';
ibContract.currency = 'EUR';
I define the start and end date and then I try to call che history funtion:
% specify the period for which we need data
bizDayConvention = 13; % i.e. BUS/252
startDate = daysadd(today,-20,bizDayConvention);
endDate = floor(now);%daysadd(today,-1,bizDayConvention);
% call the 'history' function
histTradeData = history(ib,ibContract,startDate,endDate)
When I call the history function, I get the following error:
Error using registerevent (line 72)
Error registering events. 'historicalDataEnd' is not a valid event name.
Error in ibtws/history (line 54)
c.Handle.registerevent({eventNames{i},@(varargin)ibBuiltInHistoryEventHandler(varargin{:},c,tickerID)})
Does anyone have a solution for this?
Thanks a lot,
Andrea
0 Commenti
Risposte (2)
Alok Nimrani
il 3 Gen 2019
Hi Andrea,
Please verify that you have both the following installed:
1. TWS 970.1b (latest)
2. Interactive Brokers API 9.73 (i.e. 973.06 or 973.07)
Hope this helps.
Regards,
Alok
Yair Altman
il 4 Gen 2019
Modificato: Yair Altman
il 4 Gen 2019
>> data = IBMatlab('action','history', 'symbol','IBM', 'DurationValue',5, 'BarSize','1 hour')
data =
struct with fields:
dateNum: [1×78 double]
dateTime: {1×78 cell}
open: [1×78 double]
high: [1×78 double]
low: [1×78 double]
close: [1×78 double]
volume: [1×78 double]
count: [1×78 double]
WAP: [1×78 double]
hasGaps: [1×78 logical]
>> data.dateTime'
ans =
78×1 cell array
{'20181227 11:00:00'}
{'20181227 12:00:00'}
{'20181227 13:00:00'}
{'20181227 14:00:00'}
{'20181227 15:00:00'}
{'20181227 16:00:00'}
...
0 Commenti
Vedere anche
Categorie
Scopri di più su Transaction Cost Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!