Main Content

Retrieve Bloomberg Real-Time Data

This example shows how to retrieve real-time data from Bloomberg®. To create a successful Bloomberg connection, see Connect to Bloomberg. Here, to return Bloomberg stock tick data, use the event handler v3stockticker. Instead of the default event handler, you can create your own event handler function to process Bloomberg data.

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server using blpsrv or Bloomberg B-PIPE® using bpipe.

Retrieve the last trade and volume for IBM® and Ford Motor Company® securities.

v3stockticker requires the input argument f of the realtime function to be 'Last_Trade', 'Volume', or both.

[subs,t] = realtime(c,{'IBM US Equity','F US Equity'}, ...
subs =

   Timer Object: timer-3

   Timer Settings
      ExecutionMode: fixedRate
             Period: 0.05
           BusyMode: drop
            Running: on

           TimerFcn: 1x4 cell array
           ErrorFcn: ''
           StartFcn: ''
            StopFcn: ''

** IBM US Equity ** 32433 @ 181.85 29-Oct-2013 15:50:05
** IBM US Equity ** 200 @ 181.85 29-Oct-2013 15:50:05
** IBM US Equity ** 100 @ 181.86 29-Oct-2013 15:50:05
** F US Equity ** 300 @ 17.575 30-Oct-2013 10:14:06
** F US Equity ** 100 @ 17.57 30-Oct-2013 10:14:06
** F US Equity ** 100 @ 17.5725 30-Oct-2013 10:14:06

realtime returns the Bloomberg subscription list object subs and 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 trade price and volume.

Real-time data continues to display until you use the stop or close function.

Close the Bloomberg connection.


See Also

| | |

Related Examples

More About