IB-Matlab Streaming Data

Discussion in 'App Development' started by bu2, Feb 16, 2016.

  1. bu2

    bu2

    Hello -

    I am somewhat new to Matlab and the Interactive Brokers API. I am struggling with getting live market data to stream to Matlab from IB API. I request the live data stream based on the IB-Matlab user guide, and then request data from the struct using 'quotesnumber',-1. What I do not understand is when I request data again from the stream, I get the original request and time stamp. I apologize for my ignorance, but any help here would be amazing. Here is the code I am using now:

    % Request streaming XYZ data
    reqXYZ=IBMatlab('action','query','symbol','XYZ','exchange','smart','currency','usd','quotesnumber',inf);
    % XYZ dataStruct
    pause(1)
    dataStructXYZ=IBMatlab('action','query','symbol','XYZ','quotesnumber',-1);
    pause(1)
    dataStructXYZ.data;
    % Get current ask & last price for XYZ
    pause(1)
    askXYZ = dataStructXYZ.data.askPrice
    lastXYZ = dataStructXYZ.data.lastPrice

    Every sequential time I type askXYZ into the command prompt, I get the old data from the original request. I have seen that in some examples a Java connector object is used to pass back IB events (tickPriceCallback, for example), is this what is required? Would this data need to be passed back into a GUI? Could I use that data (live market data) in the GUI in a function?

    If anyone out there could help me out I would be EXTREMELY appreciative!