realtime
Description
returns the data for the d = realtime(c,s,f)bloombergBPIPE
object c with the Bloomberg®
B-PIPE® C++ interface, security list s, and requested fields
f. realtime accesses the Bloomberg Market Data service.
[~,
returns an empty output and the timer t]
= realtime(c,s,f,eventhandler)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 a snapshot of data for one security only.
Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This example uses the Bloomberg B-PIPE C++ interface and assumes the following:
The authentication is Windows® authentication when you set
authtypeto'OS_LOGON'.The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.
The IP address for the machine running the Bloomberg B-PIPE process is
'111.11.11.112'.The port number of the machine running the Bloomberg B-PIPE process is
8194.
c is a bloombergBPIPE object.
authtype = 'OS_LOGON'; appname = ''; ipaddress = {'111.11.11.112'}; port = 8194; c = bloombergBPIPE(authtype,appname,ipaddress,port);
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)
You can create your own event handler function to process Bloomberg data. For this example, use the event handler disp that
displays Bloomberg stock tick data at the command line.
Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This example uses the Bloomberg B-PIPE C++ interface and assumes the following:
The authentication is Windows authentication when you set
authtypeto'OS_LOGON'.The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.
The IP address for the machine running the Bloomberg B-PIPE process is
'111.11.11.112'.The port number of the machine running the Bloomberg B-PIPE process is
8194.
c is a bloombergBPIPE object.
authtype = 'OS_LOGON'; appname = ''; ipaddress = {'111.11.11.112'}; port = 8194; c = bloombergBPIPE(authtype,appname,ipaddress,port);
Retrieve the last price and volume for the IBM security using the event handler disp.
[~,t] = realtime(c,'IBM 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 4
{'SecurityID' } {'LAST_PRICE'} {'SecurityID' } {'VOLUME'}
{'IBM US Equity'} {'118.490000'} {'IBM US Equity'} {'744066'}
...realtime returns the MATLAB® timer object with its properties. Then, realtime
returns the stock tick data for the IBM security with the last price and volume.
Stop the display of real-time data.
stop(t) c.Session.stopSubscriptions
Close the Bloomberg connection.
close(c)
You can create your own event handler function to process Bloomberg data. For this example, use the event handler disp that
displays Bloomberg stock tick data at the command line.
Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This example uses the Bloomberg B-PIPE C++ interface and assumes the following:
The authentication is Windows authentication when you set
authtypeto'OS_LOGON'.The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.
The IP address for the machine running the Bloomberg B-PIPE process is
'111.11.11.112'.The port number of the machine running the Bloomberg B-PIPE process is
8194.
c is a bloombergBPIPE object.
authtype = 'OS_LOGON'; appname = ''; ipaddress = {'111.11.11.112'}; port = 8194; c = bloombergBPIPE(authtype,appname,ipaddress,port);
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 the Bloomberg connection.
close(c)
Input Arguments
Bloomberg
B-PIPE connection, specified as a bloombergBPIPE object.
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
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
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
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.
MATLAB timer, returned as a MATLAB object. For details about this object, see timer.
Version History
Introduced in R2021a
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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)