This example shows how to create a connection to Bloomberg® using these Bloomberg services: Bloomberg Desktop, Bloomberg Server, B-PIPE®, and Bloomberg Data License. For details about Bloomberg connection requirements, see Data Server Connection Requirements. To ensure a successful Bloomberg connection, perform the required steps before executing a connection function. For details, see Installing Bloomberg and Configuring Connections.
c = blp
c = blp with properties: session: [1x1 com.bloomberglp.blpapi.Session] ipaddress: 'localhost' port: 8194 timeout: 0
blp
creates a Bloomberg connection object c
and
returns its properties.
Validate the connection c
.
v = isconnection(c)
v = 1
v
returns true
showing
that the Bloomberg connection is valid.
Retrieve the Bloomberg Desktop connection properties.
v = get(c)
v = session: [1x1 com.bloomberglp.blpapi.Session] ipaddress: 'localhost' port: 8194 timeout: 0
v
is a structure containing the Bloomberg session
object, IP address, port number, and timeout value.
Close the Bloomberg Desktop connection.
close(c)
Connect to the Bloomberg Server using the IP addresses of the machine running the Bloomberg Server. This code assumes the following:
The Bloomberg UUID is 12345678
.
The IP address serverip
for the
machine running the Bloomberg Server is '111.11.11.111'
.
uuid = 12345678;
serverip = '111.11.11.111';
c = blpsrv(uuid,serverip)
c = blpsrv with properties: uuid: 12345678 user: [1x1 com.bloomberglp.blpapi.impl.aT] session: [1x1 com.bloomberglp.blpapi.Session] ipaddress: '111.11.11.111' port: 8195 timeout: 0
blpsrv
connects to the machine running the Bloomberg Server
on the default port number 8195
. blpsrv
creates
the Bloomberg Server connection object c
.
Close the Bloomberg Server connection.
close(c)
Create a Bloomberg B-PIPE connection using the IP address of the machine running the Bloomberg B-PIPE process. This code assumes the following:
The authentication is Windows® Authentication
by setting authorizationtype
to 'OS_LOGON'
.
The application name is blank because you are not connecting to Bloomberg B-PIPE using an application.
The IP address serverip
for the
machine running the Bloomberg B-PIPE process is '111.11.11.112'
.
The port number is 8194
.
authorizationtype = 'OS_LOGON'; applicationname = ''; serverip = {'111.11.11.112'}; portnumber = 8194; c = bpipe(authorizationtype,applicationname,serverip,portnumber)
c = bpipe with properties: appauthtype: '' authtype: 'OS_LOGON' appname: [] user: [1x1 com.bloomberglp.blpapi.impl.aT] session: [1x1 com.bloomberglp.blpapi.Session] ipaddress: {'111.11.11.112'} port: 8194.00 timeout: 0
bpipe
connects to Bloomberg B-PIPE at
the port number 8194
. bpipe
creates
the Bloomberg B-PIPE connection object c
.
Close the B-PIPE connection.
close(c)
Create the Bloomberg Data License connection. This code assumes the following:
The Bloomberg Data License SFTP server login
name is 'dl338'
.
The Bloomberg Data License SFTP server password
is 'Lb=cYaZ'
.
The Bloomberg Data License SFTP server name is 'dlsftp.bloomberg.com'
.
The Bloomberg Data License SFTP port number is 30206
.
The decryption code is 'pDyJaV'
.
username = 'dl338'; password = 'Lb=cYaZ'; hostname = 'dlsftp.bloomberg.com'; portnumber = 30206; decrypt = 'pDyJaV'; c = bdl(username,password,hostname,portnumber,decrypt)
c = bdl with properties: Login: 'dl338' Hostname: 'dlsftp.bloomberg.com' Port: 30206 AuthOption: 'password' KeyFile: '' Connection: [1x1 com.bloomberg.datalic.api.ExtendedFTPConnection]
bdl
connects to Bloomberg Data License
at port number 30206
with password authentication. bdl
creates
the Bloomberg Data License connection object c
.
Close the Bloomberg Data License connection.
close(c)
bdl
| blp
| blpsrv
| bpipe
| close
| get
| isconnection