フィルターのクリア

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 Center および File ExchangeFinancial Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by