realtime
Real-time data for Bloomberg connection V3
Description
[
returns the subscription list subs
,t
]
= realtime(c
,s
,f
,eventhandler
)subs
and the timer t
associated with the real-time event handler for the subscription list. Given connection
c
, the realtime
function subscribes to a security or
securities s
and requests fields f
, to update in real
time while running an event handler eventhandler
.
Examples
Retrieve Data for One Security
Retrieve a snapshot of data for one security only.
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 of the IBM® security.
d = realtime(c,'IBM US Equity',{'Last_Trade','Volume'})
d = LAST_TRADE: '181.76' VOLUME: '7277793'
Close the Bloomberg connection.
close(c)
Retrieve Data for One Security Using the Event Handler v3stockticker
You can create your own event handler function to process Bloomberg data. For this example, use the event handler
v3stockticker
that returns Bloomberg stock tick 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 the IBM security using the event handler v3stockticker
.
v3stockticker
requires the input argument f
of
realtime
to be 'Last_Trade'
,
'Volume'
, or both.
[subs,t] = realtime(c,'IBM US Equity',{'Last_Trade','Volume'},... 'v3stockticker')
subs = com.bloomberglp.blpapi.SubscriptionList@79f07684 Timer Object: timer-2 Timer Settings ExecutionMode: fixedRate Period: 0.05 BusyMode: drop Running: on Callbacks TimerFcn: 1x4 cell array ErrorFcn: '' StartFcn: '' StopFcn: '' ** 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 ...
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 security with the volume and last trade price.
Real-time data continues to display until you execute the stop
or
close
function.
Close the Bloomberg connection.
close(c)
Retrieve Data for Multiple Securities Using the Event Handler v3stockticker
You can create your own event handler function to process Bloomberg data. For this example, use the event handler
v3stockticker
that returns Bloomberg stock tick 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'}, ... {'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)
Retrieve Data for One Security Using the Event Handler v3showtrades
You can create your own event handler function to process Bloomberg data. For this example, use the event handler
v3showtrades
that creates a figure showing requested data for a
security.
Create the Bloomberg connection.
c = blp;
Alternatively, you can connect to the Bloomberg Server using blpsrv
or Bloomberg
B-PIPE using bpipe
.
Retrieve volume, last trade, bid, ask, and volume weight adjusted price (VWAP) data
for the IBM security using the event handler v3showtrades
.
v3showtrades
requires the input argument f
of
realtime
to be any combination of: 'Last_Trade'
,
'Bid'
, 'Ask'
, 'Volume'
, and
'VWAP'
.
[subs,t] = realtime(c,'IBM US Equity',... {'Last_Trade','Bid','Ask','Volume','VWAP'},... 'v3showtrades')
subs = com.bloomberglp.blpapi.SubscriptionList@5c17dcdb Timer Object: timer-4 Timer Settings ExecutionMode: fixedRate Period: 0.05 BusyMode: drop Running: on Callbacks TimerFcn: 1x4 cell array ErrorFcn: '' StartFcn: '' StopFcn: ''
realtime
returns the Bloomberg subscription list object subs
and the MATLAB timer object with its properties. Then, v3showtrades
displays a figure showing volume, last trade, bid, ask, and volume weight adjusted price
(VWAP) data for IBM.
Real-time data continues to display until you execute the stop
or
close
function.
Close the Bloomberg connection.
close(c)
Retrieve Data for One Security Using the Event Handler v3pricevol
You can create your own event handler function to process Bloomberg data. For this example, use the event handler v3pricevol
that creates a figure showing last price and volume data for a security.
Create the Bloomberg connection.
c = blp;
Alternatively, you can connect to the Bloomberg Server using blpsrv
or Bloomberg
B-PIPE using bpipe
.
Retrieve last price and volume data for the IBM security using event handler v3pricevol
.
v3pricevol
requires the input argument f
of
realtime
to be 'Last_Price'
,
'Volume'
, or both.
[subs,t] = realtime(c,'IBM US Equity',{'Last_Price','Volume'},... 'v3pricevol')
subs = com.bloomberglp.blpapi.SubscriptionList@16f66676 Timer Object: timer-5 Timer Settings ExecutionMode: fixedRate Period: 0.05 BusyMode: drop Running: on Callbacks TimerFcn: 1x4 cell array ErrorFcn: '' StartFcn: '' StopFcn: ''
realtime
returns the Bloomberg subscription list object subs
and the MATLAB timer object with its properties. Then, v3pricevol
displays a figure showing last price and volume data for IBM.
Real-time data continues to display until you execute the stop
or
close
function.
Close the Bloomberg connection.
close(c)
Input Arguments
s
— Security list
character vector | string scalar | cell array of character vectors | string array
Security list, specified as a character vector or string scalar for one security or a cell array of character vectors or string array for multiple securities. You can specify the security by name or by CUSIP, and with or without the pricing source.
Data Types: char
| cell
| string
f
— Bloomberg data fields
character vector | string scalar | cell array of character vectors | string array
Bloomberg data fields, specified as a character vector, string scalar, cell array of character vectors, or string array. A character vector or string denotes one Bloomberg data field name. A cell array of character vectors or string array denotes multiple Bloomberg data field names. For details about the fields you can specify, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.
Example: {'LAST_PRICE';'OPEN'}
Data Types: char
| cell
| string
eventhandler
— Event handler
character vector | string scalar
Event handler, specified as a character vector or string scalar that denotes the name of an event handler function that you define. You can define an event handler function to process any type of real-time Bloomberg events. The specified event handler function runs every time the timer fires.
Data Types: char
| string
Output Arguments
d
— Bloomberg data
structure (default) | table | timetable
Bloomberg data, returned as a structure, table, or timetable. The data type of the Bloomberg data depends on the DataReturnFormat and DatetimeType properties of the connection object. For details about the data, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.
subs
— Bloomberg subscription
object
Bloomberg subscription, returned as a Bloomberg object. For details about this object, see the Bloomberg API Developer’s Guide using the WAPI <GO> option from the Bloomberg terminal.
t
— MATLAB timer
object
MATLAB timer, returned as a MATLAB object. For details about this object, see timer
.
Version History
Introduced in R2010a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)