Borrar filtros
Borrar filtros

Trading toolbox getdata error

2 visualizaciones (últimos 30 días)
Gabriel Hara
Gabriel Hara el 2 de Jul. de 2020
Comentada: Gabriel Hara el 6 de Jul. de 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)

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Financial Data en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by