realtime with Interactive Brokers

3 views (last 30 days)
Nicholas McCormick
Nicholas McCormick on 4 May 2016
Answered: Scott Meier on 9 Nov 2018
I am curious if there is a way to directly set the data that the function 'realtime' outputs to a variable. The way it is shown the the Matlab help file, http://www.mathworks.com/help/trading/ibtws.realtime.html, whatever variable you assign to 'realtime' gets set to the ID number, and then it creates a variable called ibBuiltInRealtimeData. Once ibBuiltInRealtimeData loads, then I can set it equal to a variable, but it would be preferable to not have to wait for the variable to load in the workspace since this is inside a loop to get data for thousands of different contracts.
I know that 'getdata' does essentially what I am trying to do, but it rarely works for me.
Thanks in advance for any help,
Nick

Answers (1)

Scott Meier
Scott Meier on 9 Nov 2018
I have done this exactly. I open a new,unique connection for just the 'realtime' communications. I call the 'realtime' function and then assign each element of the 'realtime' response to a unique variable. I still use a loop to update the variables, but I no longer need to repeatedly use the 'getdata' function.

Community Treasure Hunt

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

Start Hunting!