MATLAB: How to use the “blp.realtime” function to retrieve BID, ASK and LAST_PRICE data using the “v3stockticker” event handler in Datafeed Toolbox R2014a

Datafeed Toolbox

I am looking at the examples on the documentation page for the "realtime" function for Bloomberg. One of them shows how to retrieve live tick data for IBM using the "v3stockticker" event handler:
 
>> [subs,t] = realtime(c,'IBM US Equity',{'Last_Trade','Volume'},'v3stockticker');
** IBM US Equity ** 100 @ 181.81 29-Oct-2013 15:48:50
** IBM US Equity ** 100 @ 181.795 29-Oct-2013 15:48:50
** IBM US Equity ** 100 @ 181.8065 29-Oct-2013 15:48:51
Instead of retrieving LAST_TRADE and VOLUME, I would like to retrieve BID, ASK and LAST_PRICE. I tried the following it does not work. Nothing is displayed in the Command Window:
 
>> [subs,t] = realtime(c,'IBM US Equity',{'BID','ASK','LAST_PRICE'},'v3stockticker');
What am I doing wrong?

Best Answer

The "realtime" method of the "blp" class sets up a timer to listen to incoming data from the Bloomberg server. Every time an event, such as a trade, occurs the event handler specified as the 4th input argument to "realtime" is executed. The event handler is the function in charge of processing the incoming data. The "v3stockticker" event handler is an example event handler. It was written to show how to display LAST_TRADE and VOLUME information in the Command Window. It is the responsibility of the user to write his or her own event handler in order to process the correct data.
For example, if you wanted to display the BID, ASK and LAST_PRICE fields in the Command Window in a similar fashion as "v3stockticker" does, you could use the attached exampleEventHandler.m file.
Note that you are not restricted to displaying the data in the Command Window. For example, the "v3pricevol" event handler is an example that illustrates how to display, and continuously update, incoming trades on a chart:
 
>> [subs,t] = realtime(c,'IBM US Equity',{'Last_Price','Volume'},'v3pricevol')