필터 지우기
필터 지우기

Trading toolbox getdata error

조회 수: 2 (최근 30일)
Gabriel Hara
Gabriel Hara 2020년 7월 2일
댓글: Gabriel Hara 2020년 7월 6일
i got the below error when trying to retrieve realtime data, and not getting the bid_price and X_price
windows 10 64bit
matlab: R2020A
TWS and API latest
ERROR
Error using comeventcallback (line 24)
Error firing event 'tickPrice' to '@(varargin)ibBuiltInGetDataEventHandler(varargin{:},c)'.
Warning: Error occurred while evaluating listener callback.
> In ibtws/getdata (line 62)
Error using comeventcallback (line 24)
Error firing event 'tickPrice' to '@(varargin)ibBuiltInGetDataEventHandler(varargin{:},c)'.
Warning: Error occurred while evaluating listener callback.
> In ibtws/getdata (line 62)
Error using comeventcallback (line 24)
Error firing event 'tickPrice' to '@(varargin)ibBuiltInGetDataEventHandler(varargin{:},c)'.
Warning: Error occurred while evaluating listener callback.
> In ibtws/getdata (line 62)
d =
struct with fields:
BID_SIZE: 18.00
ASK_SIZE: 41.00
LAST_SIZE: 2.00
VOLUME: 78596.00
Code
clear all;
ib = ibtws('127.0.0.1', 7497,1)
ibContract = ib.Handle.createContract;
ibContract.symbol = 'INTC';
ibContract.secType = 'STK';
ibContract.exchange = 'SMART';
ibContract.primaryExchange = 'NASDAQ';
ibContract.currency = 'USD';
format bank
d = getdata(ib,ibContract) % Return market data
close(ib)

채택된 답변

Vashist Hegde
Vashist Hegde 2020년 7월 3일
To debug, put a break point at line 103 of ibtws/getdata, which can be found by using "edit". The particular line is as follows:
switch varargin{9}.tickType
Get the output of "varargin{9}".
The field in "varargin{9}" is named "Price" (capital P) while the cases in "getdata" use "price" (lowercase p). This is the cause of the error.
As a workaround, copy the "getdata" file and change the field name to match the returned structure., then use the modified version instead of the normal "getdata".
  댓글 수: 1
Gabriel Hara
Gabriel Hara 2020년 7월 6일
Vashist thanks a lot for your fast response. i checked your proposal and now it is working. thanks a lot!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Financial Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by