Error with " Request Interactive Brokers Historical Data" example

1 回表示 (過去 30 日間)
Mike A
Mike A 2018 年 7 月 27 日
コメント済み: terry dylan 2019 年 1 月 13 日
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.

回答 (3 件)

John Pries
John Pries 2018 年 10 月 25 日
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 ...
  1 件のコメント
françois robert
françois robert 2018 年 10 月 29 日
I have the same issue, did you find a solution ?

サインインしてコメントする。


Scott Meier
Scott Meier 2018 年 11 月 9 日
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 件のコメント
Scott Meier
Scott Meier 2019 年 1 月 11 日
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 2019 年 1 月 13 日
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

サインインしてコメントする。


Yair Altman
Yair Altman 2019 年 1 月 4 日
編集済み: Yair Altman 2019 年 1 月 4 日
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 件のコメント
Mike A
Mike A 2019 年 1 月 10 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTransaction Cost Analysis についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by