Error with " Request Interactive Brokers Historical Data" example

3 visualizzazioni (ultimi 30 giorni)
I am receiving an error when I follow the help example Request Interactive Brokers Historical Data.
ib = ibtws('',7496) %
ibContract = ib.Handle.createContract;
ibContract.symbol = 'IBM';
ibContract.secType = 'STK';
ibContract.exchange = 'SMART';
ibContract.primaryExchange = 'NYSE';
ibContract.currency = 'USD';
getdata(ib,ibContract)
startdate = floor(now) - 5;
enddate = floor(now);
d = history(ib,ibContract,startdate,enddate)
the output:
ans =
struct with fields:
LAST_PRICE: 145.19
LAST_SIZE: 1.00
VOLUME: 23572.00
BID_PRICE: 145.19
BID_SIZE: 5.00
ASK_PRICE: 145.20
ASK_SIZE: 3.00
d =
'No historical data query found for ticker id:975'
However the API error logs:
11:25:22:998 <- 20-975-0-IBM-STK--0---SMART-NYSE-USD---0-20180728 00:00:00-1 day-6 D-0-TRADES-1-0--
11:25:23:143 -> --17-975-20180722 00:00:00-20180728 00:00:00-6-20180720-149.11-149.50-146.10-146.25-56435-147.146-31676-20180723-146.26-146.70-145.01-145.85-31681-145.653-17672-20180724-145.73-147.04-145.73-146.05-33764-146.483-18819-20180725-145.80-146.91-145.50-145.80-30822-146.152-19893-20180726-146.74-149.27-146.34-147.48-42520-147.469-23727-20180727-146.93-147.36-144.66-145.19-19673-145.926-13840-
11:25:23:147 <- 25-1-975-
11:25:23:148 -> ---=4-2-975-366-No historical data query found for ticker id:975-
11:25:23:148 <- 25-1-975-
11:25:23:148 -> ---=4-2-975-366-No historical data query found for ticker id:975-
using 2018a with API 9.73.07
It doesn't matter the dates(1 day 10 days ago) or securities I try is still get the same error. Also Timeseries does not work a well, the API logs shows the data but the no historical data error.

Risposte (3)

John Pries
John Pries il 25 Ott 2018
Anyone solve this issue. I've got it too. It seems like 'historicalDataEnd' event is happening before 'historicalData' and closing event listeners and clearing persistent variables ...

Scott Meier
Scott Meier il 9 Nov 2018
I believe the second line of code shown below is missing from the timeseries.m file. I'm using 2018b. I copied this line from the 2017a version.
case 'historicalDataEnd'
assignin('base','ibBuiltInIntraDayData',ibBuiltInIntraDayData);
% Clear persistent variables and event listeners
clear ibBuiltInIntraDayDataCounter ibBuiltInIntraDayData
  5 Commenti
Scott Meier
Scott Meier il 11 Gen 2019
Yes, I experienced this often in the beginning, possibly from making too many history requests in a short time. If you use the IB Gateway instead of TWS, you can view the API messages and this can give a clue as to what's happening. It may be possible in TWS, but I'm not sure how to do that.
terry dylan
terry dylan il 13 Gen 2019
Hi Scott,
you can view the TWS log book, in TWS, go to Classic TWS view, then account->Diagnostics -> view TWS log book,
then you can export today's log book, in the file, there are details of messages, although i cant' understand very much.
the problem i have now, is still data request freeze, when i reconnect and reconnect from TWS, this doesnt happend with API 971, later version of API, stuck all the time................... this is such a big headache to me
best regards
Terry

Accedi per commentare.


Yair Altman
Yair Altman il 4 Gen 2019
Modificato: Yair Altman il 4 Gen 2019
Here's how you can fetch IB's historical data using the IB-Matlab connector:
>> 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'}
...
For additional details, see https://undocumentedmatlab.com/ib-matlab
  1 Commento
Mike A
Mike A il 10 Gen 2019
It is sad that you pay for a toolbox with the expectations that it will work and the only real solution that matlab has is to spen $300 a year with a third party vendor.

Accedi per commentare.

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by