emsxOrderBlotter

Bloomberg EMSX example order blotter

Syntax

  • [t,subs] = emsxOrderBlotter(c) example

Description

example

[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.

Examples

expand all

Display the Order in an Order Blotter

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

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

 
subs =
 
com.bloomberglp.blpapi.SubscriptionList@3e24da58

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_ORDER_TYPE = 'MKT';
order.EMSX_BROKER = 'BB';
order.EMSX_TIF = 'DAY';
order.EMSX_HAND_INSTRUCTION = 'ANY';
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.

close(c)

Input Arguments

expand all

c — Bloomberg EMSX service connectionconnection object

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

Output Arguments

expand all

t — MATLAB® timerobject

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

subs — Bloomberg EMSX subscription listsubscription list object

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

More About

expand all

Tips

For details about Bloomberg EMSX, see the EMSX API Programmer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Was this topic helpful?