How can I place the realtime data retrieved from Bloomberg in the base workspace using Datafeed Toolbox 3.5 (R2010a)?

1 view (last 30 days)
I want to use Bloomberg's V3 interface to retrieve the realtime data using BLP.REALTIME and place it in MATLAB's base workspace.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Dec 2010
[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)
%SAMPLECALLBACK Datafeed Toolbox Bloomberg realtime example.
% SAMPLECALLBACK (D,S) demonstrates the Datafeed Toolbox Bloomberg V3
% security realtime data import functionality. D is the structure
% containing the real time data and S is the security ID returned as the
% topic of the processed message.
%Process ticks
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.

More Answers (0)

Tags

Products


Release

R2010a

Community Treasure Hunt

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

Start Hunting!