[SL,T] = realtime(C,S,F,API) subscribes to a given security or list of securities S requesting the fields F and runs the specified function by API. It returns the subscription list, SL and the timer T associated with the real time callback for the subscription list.
The following callback (may be replaced by API above) will return the realtime data retrieved from Bloomberg to MATLAB's base workspace.
Create a new file, copy the function below and save it in the current folder.
function samplecallback(d,s)
if isempty(d)
return
end
d.SEC = s;
assignin('base','A',d)
end
You can use the following code snippet to make use of this callback with BLP.REALTIME:
b = blp
[s,t] = realtime(b,ticker,fields,'samplecallback')
openvar('A')
Please replace ticker and fields with list of securities and desired fields respectively. Executing the above shall create the variable A in the base workspace (based on the data retrieved realtime) and open it in the variable editor.