IB-Matlab Streaming Data
Show older comments
Hi together,
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. Here is the code I am using:
reqId = IBMatlab('action','query', 'localsymbol','XYZ', 'currency','EUR', 'sectype','STK', 'exchange','SMART', 'QuotesNumber',1000);
start(timer('period',0.25, 'executionMode','fixedRate', 'timerFcn',@myCallback)) % start a 0.25-secs timer
function myCallback(hTimer,eventdata) latestDataStruct = IBMatlab('action','query', 'localsymbol','XYZ', 'QuotesNumber',-1);
bid = latestDataStruct.data.bidPrice;
ask= latestDataStruct.data.askPrice; end
Every sequential time I get the old data from the original request. What I‘m doing wrong? Please help me out.
Kind regards and thank you in advance
Answers (0)
Categories
Find more on Equity Derivatives in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!