Create Bloomberg EMSX connection
The emsx function creates an emsx
object, which represents a Bloomberg® EMSX connection. After you create an emsx object, you can
use the object functions to create and route orders, and manage orders and routes. For
details about Bloomberg EMSX, see the EMSX API Programmers Guide.
creates a connection to the local Bloomberg EMSX communications server using the service
c = emsx(servicename)servicename.
creates a connection to a remote EMSX server using the specified service
name, authentication identifier, and server IP address.c = emsx(servicename,authid,serverip)
also specifies the port number for the remote connection.c = emsx(servicename,authid,serverip,portnumber)
also specifies the IP address of the machine you use to access the
Bloomberg Terminal for the remote connection.c = emsx(servicename,authid,serverip,portnumber,terminalip)
servicename — Bloomberg EMSX service name'//blp/emapisvc_beta' | '//blp/emapisvc'Bloomberg EMSX service name, specified as one of these connection types.
| Connection Type | Bloomberg EMSX Service Name |
|---|---|
|
Test |
|
|
Production |
|
authid — Bloomberg EMSX authentication identifierBloomberg EMSX authentication identifier, specified as a character vector or string scalar.
For Bloomberg EMSX Desktop, specify an empty character vector or string scalar because this input argument is not required. For Bloomberg EMSX Server, this input argument is required.
serverip — Bloomberg EMSX Server IP addressBloomberg EMSX Server IP address, specified as a character vector or string scalar. This address is the IP address of the machine running the Bloomberg EMSX Server process.
For Bloomberg EMSX Desktop, specify an empty character vector or string scalar because this input argument is not required. For Bloomberg EMSX Server, this input argument is required.
Example: '111.222.333.44'
portnumber — Port number8194 (default) | numeric scalarPort number of the machine running the EMSX Server process, specified as a numeric scalar.
For Bloomberg EMSX Desktop, specify an empty array because this input argument is not required. For Bloomberg EMSX Server, this input argument is required.
terminalip — Bloomberg Terminal IP address"localhost" (default) | character vector | string scalarBloomberg Terminal IP address, specified as a character vector or string scalar. This address is the IP address of the machine you use to access the Bloomberg Terminal.
Example: '111.222.333.44'
Session — Bloomberg EMSX sessionThis property is read-only.
Bloomberg EMSX session, specified as a Bloomberg EMSX session object.
Example: [1x1
com.bloomberglp.blpapi.Session]
Service — Bloomberg EMSX serviceThis property is read-only.
Bloomberg EMSX service, specified as a Bloomberg EMSX service object.
The emsx function sets this property using the
servicename input argument.
Example: [1x1
com.bloomberglp.blpapi.impl.aQ]
Ipaddress — IP address'localhost' (default) | character vectorThis property is read-only.
IP address of the machine running Bloomberg EMSX, specified as a character vector.
Data Types: char
Port — Port numberThis property is read-only.
Port number of the machine running Bloomberg EMSX, specified as a numeric scalar.
Example:
8194
Data Types: double
User — UserThis property is read-only.
User, specified as a Bloomberg API Java object for Bloomberg EMSX Server. For Bloomberg EMSX Desktop, this property is empty.
Example:
[1×1 com.bloomberglp.blpapi.impl.by]
createOrder | Create Bloomberg EMSX order |
routeOrder | Route Bloomberg EMSX order |
routeOrderWithStrat | Route Bloomberg EMSX order with strategies |
groupRouteOrder | Route group of Bloomberg EMSX orders |
groupRouteOrderWithStrat | Route group of Bloomberg EMSX orders with strategies |
createOrderAndRoute | Create and route Bloomberg EMSX order |
createOrderAndRouteWithStrat | Create and route Bloomberg EMSX order with strategies |
createBasket | Create basket of Bloomberg EMSX orders |
manualFill | Fill Bloomberg EMSX orders manually |
modifyOrder | Modify Bloomberg EMSX order |
modifyRoute | Modify Bloomberg EMSX route |
modifyRouteWithStrat | Modify Bloomberg EMSX route with strategies |
deleteOrder | Delete Bloomberg EMSX order |
deleteRoute | Delete Bloomberg EMSX active shares |
processEvent | Sample Bloomberg EMSX event handler |
emsxOrderBlotter | Bloomberg EMSX example order blotter |
getBrokerInfo | Obtain Bloomberg EMSX broker and strategy information |
getAllFieldMetaData | Obtain Bloomberg EMSX field information |
First, create a Bloomberg EMSX test service connection. Then, obtain broker information.
Create a connection c to the Bloomberg EMSX test service. You can place test calls using this
service.
c = emsx('//blp/emapisvc_beta')c =
emsx with properties:
Session: [1x1 com.bloomberglp.blpapi.Session]
Service: [1x1 com.bloomberglp.blpapi.impl.aQ]
Ipaddress: 'localhost'
Port: 8194
User: []
MATLAB® returns c as the connection to the
Bloomberg EMSX test service with the following properties:
Bloomberg EMSX session object
Bloomberg EMSX service object
IP address of the machine running the Bloomberg EMSX test service
Port number of the machine running the Bloomberg EMSX test service
Define the broker and strategy information structure
brokerstrat. Obtain broker information using the
Bloomberg EMSX connection c and structure
brokerstrat.
The EMSX_BROKERS field lists the Bloomberg EMSX brokers.
brokerstrat.EMSX_TICKER = 'ABCD US Equity';
r = getBrokerInfo(c,brokerstrat)
r =
EMSX_BROKERS: {2x1 cell} Close the Bloomberg EMSX connection.
close(c)
First, create a Bloomberg EMSX production service connection. Then, obtain broker information.
Create a connection c to the Bloomberg EMSX production service. You can place live calls using this
service.
c = emsx('//blp/emapisvc')c =
emsx with properties:
Session: [1x1 com.bloomberglp.blpapi.Session]
Service: [1x1 com.bloomberglp.blpapi.impl.aQ]
Ipaddress: 'localhost'
Port: 8194
User: []
MATLAB returns c as the connection to the
Bloomberg EMSX production service with the following properties:
Bloomberg EMSX session object
Bloomberg EMSX service object
IP address of the machine running the Bloomberg EMSX production service
Port number of the machine running the Bloomberg EMSX production service
Define the broker and strategy information structure
brokerstrat. Obtain broker information using the
Bloomberg EMSX connection c and structure
brokerstrat.
The EMSX_BROKERS field lists the Bloomberg EMSX brokers.
brokerstrat.EMSX_TICKER = 'ABCD US Equity';
r = getBrokerInfo(c,brokerstrat)
r =
EMSX_BROKERS: {2x1 cell} Close the Bloomberg EMSX connection.
close(c)
Obtain broker information using a Bloomberg EMSX connection to a remote server.
Create a connection c to the Bloomberg EMSX remote server. Specify the service name, authentication
identifier, and server IP address.
servicename = '//blp/emapisvc_beta'; authid = 'abcdef123'; serverip = '111.222.333.44'; c = emsx(servicename,authid,serverip)
c =
emsx with properties:
Session: [1x1 com.bloomberglp.blpapi.Session]
Service: [1x1 com.bloomberglp.blpapi.impl.aQ]
Ipaddress: '111.222.333.44'
Port: 8194
User: [1×1 com.bloomberglp.blpapi.impl.by]
MATLAB returns c as the connection to the
Bloomberg EMSX test service with the following properties:
Bloomberg EMSX session object
Bloomberg EMSX service object
IP address of the machine running the Bloomberg EMSX test service
Port number of the machine running the Bloomberg EMSX test service
Bloomberg API Java object
Define the broker and strategy information structure
brokerstrat. Obtain broker information using the
Bloomberg EMSX connection c and structure
brokerstrat.
The EMSX_BROKERS field lists the Bloomberg EMSX brokers.
brokerstrat.EMSX_TICKER = 'ABCD US Equity';
r = getBrokerInfo(c,brokerstrat)
r =
EMSX_BROKERS: {2x1 cell} Close the Bloomberg EMSX connection.
close(c)
Obtain broker information using a Bloomberg EMSX connection to a remote server with a port number.
Create a connection c to the Bloomberg EMSX remote server. Specify the service name, authentication
identifier, server IP address, and port number.
servicename = '//blp/emapisvc_beta'; authid = 'abcdef123'; serverip = '111.222.333.44'; portnumber = 8194; c = emsx(servicename,authid,serverip,portnumber)
c =
emsx with properties:
Session: [1x1 com.bloomberglp.blpapi.Session]
Service: [1x1 com.bloomberglp.blpapi.impl.aQ]
Ipaddress: '111.222.333.44'
Port: 8194
User: [1×1 com.bloomberglp.blpapi.impl.by]
MATLAB returns c as the connection to the
Bloomberg EMSX test service with the following properties:
Bloomberg EMSX session object
Bloomberg EMSX service object
IP address of the machine running the Bloomberg EMSX test service
Port number of the machine running the Bloomberg EMSX test service
Bloomberg API Java object
Define the broker and strategy information structure
brokerstrat. Obtain broker information using the
Bloomberg EMSX connection c and structure
brokerstrat.
The EMSX_BROKERS field lists the Bloomberg EMSX brokers.
brokerstrat.EMSX_TICKER = 'ABCD US Equity';
r = getBrokerInfo(c,brokerstrat)
r =
EMSX_BROKERS: {2x1 cell} Close the Bloomberg EMSX connection.
close(c)
Obtain broker information using a Bloomberg EMSX connection to a remote server with a port number and Bloomberg Terminal IP address.
Create a connection c to the Bloomberg EMSX remote server. Specify the service name, authentication
identifier, server IP address, and port number. Also, specify the IP address
of the machine you use to access the Bloomberg Terminal.
servicename = '//blp/emapisvc_beta'; authid = 'abcdef123'; serverip = '111.222.333.44'; portnumber = 8194; terminalip = '5555.222.333.44'; c = emsx(servicename,authid,serverip,portnumber,terminalip)
c =
emsx with properties:
Session: [1x1 com.bloomberglp.blpapi.Session]
Service: [1x1 com.bloomberglp.blpapi.impl.aQ]
Ipaddress: '111.222.333.44'
Port: 8194
User: [1×1 com.bloomberglp.blpapi.impl.by]
MATLAB returns c as the connection to the
Bloomberg EMSX test service with the following properties:
Bloomberg EMSX session object
Bloomberg EMSX service object
IP address of the machine running the Bloomberg EMSX test service
Port number of the machine running the Bloomberg EMSX test service
Bloomberg API Java object
Define the broker and strategy information structure
brokerstrat. Obtain broker information using the
Bloomberg EMSX connection c and structure
brokerstrat.
The EMSX_BROKERS field lists the Bloomberg EMSX brokers.
brokerstrat.EMSX_TICKER = 'ABCD US Equity';
r = getBrokerInfo(c,brokerstrat)
r =
EMSX_BROKERS: {2x1 cell} Close the Bloomberg EMSX connection.
close(c)