Main Content


Bloomberg EMSX example order blotter



[t,subs] = emsxOrderBlotter(c) displays a trader's order information. c is the Bloomberg® EMSX connection, t is the timer object associated with the event handler, and subs is the Bloomberg EMSX subscription list.


collapse all

Create the Bloomberg EMSX connection c.

 c = emsx('//blp/emapisvc_beta');

Open Bloomberg EMSX order blotter using the Bloomberg EMSX connection c.

[t,subs] = emsxOrderBlotter(c)
   Timer Object: timer-1

   Timer Settings
      ExecutionMode: fixedRate
             Period: 1
           BusyMode: drop
            Running: on

           TimerFcn: {@processEventToBlotter [1x1 emsx]}
           ErrorFcn: ''
           StartFcn: ''
            StopFcn: ''

subs =

emsxOrderBlotter returns the timer object output and the Bloomberg EMSX subscription list object. For details about the timer object, see timer.

The order blotter displays the current order information for a trader.

Create the order request structure order to define the order parameters. This code creates a buy market order for 330 shares of IBM®. This code uses the broker BB with the time in force set to DAY and any hand instruction. Convert the number of shares to a 32-bit signed integer using int32.

order.EMSX_TICKER = 'IBM';
order.EMSX_AMOUNT = int32(330);
order.EMSX_BROKER = 'BB';
order.EMSX_TIF = 'DAY';
order.EMSX_SIDE = 'BUY';

Create and route the order using the Bloomberg EMSX connection c and the order request structure order. Use the custom event handler processEventToBlotter by setting the name-value pair argument 'useDefaultEventHandler' to false.

events = createOrderAndRoute(c,order,'useDefaultEventHandler',false)
events =


 CreateOrderAndRoute = {
     EMSX_SEQUENCE = 381499
     EMSX_ROUTE_ID = 1
     MESSAGE = Order created and routed

createOrderAndRoute creates the order, routes the order, and returns a structure events that contains an empty double. processEventToBlotter displays output from createOrderAndRoute with the order number EMSX_SEQUENCE, route number EMSX_ROUTE_ID, and message: Order created and routed.

The order blotter updates using the information for the created and routed order, where order number EMSX_SEQUENCE is 381499, using the event handler function processEventToBlotter. The order blotter updates as orders are created and managed.

Close the Bloomberg EMSX connection.


Input Arguments

collapse all

Bloomberg EMSX service connection, specified as a connection object created using emsx.

Output Arguments

collapse all

MATLAB timer, returned as a MATLAB object. For details, see timer.

Bloomberg EMSX subscription list, returned as a Bloomberg EMSX subscription list object.

Introduced in R2013a