Retrieve Bloomberg Intraday Tick Data Using Bloomberg B-PIPE C++ Interface
This example shows how to retrieve intraday tick data from Bloomberg®.
Connect to Bloomberg
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
authtype
to'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);
Validate the Bloomberg connection.
v = isconnection(c)
v = 1
v
returns true
showing that the Bloomberg connection is valid.
Retrieve Intraday Tick Data
Retrieve the trade tick series for the past 50 days for the IBM® security aggregated into 5-minute intervals.
d = timeseries(c,'IBM US Equity',{floor(now)-50,floor(now)},5,'Trade')
ans = Columns 1 through 7 735487.40 187.20 187.60 187.02 187.08 207683.00 560.00 735487.40 187.03 187.13 186.65 186.78 46990.00 349.00 735487.40 186.78 186.78 186.40 186.47 51589.00 399.00 ... Column 8 38902968.00 8779374.00 9626896.00 ...
The columns in d
contain the following:
Numeric representation of date and time
Open price
High price
Low price
Closing price
Volume of ticks
Number of ticks
Total tick value in the bar
The first row of data shows prices and tick data for the current date. The next row shows tick data for 5 minutes later.
Close Bloomberg Connection
close(c)