Retrieve Bloomberg Real-Time Data Using Bloomberg Desktop C++ Interface
This example shows how to retrieve real-time data from Bloomberg®. Here, to display Bloomberg stock tick data at the command line, use the event handler
disp
. Instead of the default event handler, you can create your own
event handler function to process Bloomberg data.
Connect to Bloomberg
Create the Bloomberg connection using the Bloomberg Desktop C++ interface.
c = bloomberg;
Validate the Bloomberg connection.
v = isconnection(c)
v = 1
v
returns true
showing that the Bloomberg connection is valid.
Retrieve Real-Time Data
Retrieve the last price and volume for IBM® and Ford Motor Company® securities.
[~,t] = realtime(c,{'IBM US Equity','F US Equity'}, ... {'LAST_PRICE','VOLUME'},'disp')
t = Timer Object: timer-4 Timer Settings ExecutionMode: fixedRate Period: 0.05 BusyMode: drop Running: off Callbacks TimerFcn: 1x5 cell array ErrorFcn: '' StartFcn: '' StopFcn: '' Columns 1 through 6 {'SecurityID' } {'LAST_PRICE'} {'SecurityID' } {'VOLUME' } {'SecurityID' } {'LAST_PRICE'} {'F US Equity'} {'8.960000' } {'F US Equity'} {'13423731'} {'IBM US Equity'} {'118.490000'} Columns 7 through 8 {'SecurityID' } {'VOLUME'} {'IBM US Equity'} {'744066'} ...
realtime
returns the MATLAB® timer object with its properties. Then, realtime
returns
the stock tick data for the IBM and Ford Motor Company securities with the last price and volume.
Stop the display of real-time data.
stop(t) c.Session.stopSubscriptions
Close Bloomberg Connection
close(c)
See Also
Objects
Functions
Related Topics
- Retrieve Bloomberg Current Data Using Bloomberg Desktop C++ Interface
- Retrieve Bloomberg Historical Data Using Bloomberg Desktop C++ Interface
- Retrieve Current and Historical Data Using Bloomberg Desktop C++ Interface
- Retrieve Bloomberg Intraday Tick Data Using Bloomberg Desktop C++ Interface
- Writing and Running Custom Event Handler Functions