Filter löschen
Filter löschen

Trading toolbox getdata error

2 Ansichten (letzte 30 Tage)
Gabriel Hara
Gabriel Hara am 2 Jul. 2020
Kommentiert: Gabriel Hara am 6 Jul. 2020
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)

Akzeptierte Antwort

Vashist Hegde
Vashist Hegde am 3 Jul. 2020
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 Kommentar
Gabriel Hara
Gabriel Hara am 6 Jul. 2020
Vashist thanks a lot for your fast response. i checked your proposal and now it is working. thanks a lot!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Financial Data finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by