Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 realtime to be 'Last_Trade', 'Volume', or both.

[subs,t] = realtime(c,{'IBM US Equity','F US Equity'},...
                    {'Last_Trade','Volume'},'v3stockticker')
subs =
 
com.bloomberglp.blpapi.SubscriptionList@6c1066f6
 

   Timer Object: timer-3

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

   Callbacks
           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.

close(c)

See Also

| | |

Related Examples

More About

Was this topic helpful?