Effacer les filtres
Effacer les filtres

Trading toolbox getdata error

2 vues (au cours des 30 derniers jours)
Gabriel Hara
Gabriel Hara le 2 Juil 2020
Commenté : Gabriel Hara le 6 Juil 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)

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Financial Data dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by