Main Content

modifyRoute

Modify Bloomberg EMSX route

Description

events = modifyRoute(c,modroute) modifies a Bloomberg® EMSX route using the Bloomberg EMSX connection c and route request modroute. modifyRoute returns a status message using the default event handler.

example

events = modifyRoute(c,modroute,'timeOut',timeout) specifies a timeout value timeout for the execution of the default event handler.

example

modifyRoute(___,'useDefaultEventHandler',false) modifies a Bloomberg EMSX route using any of the input arguments in the previous syntaxes and a custom event handler. Write a custom event handler to process the events associated with modifying routes. This syntax does not have an output argument because the custom event handler processes the contents of the event queue. If you want to use the default event handler instead, set the flag 'useDefaultEventHandler' to true and use the events output argument. By default, the flag 'useDefaultEventHandler' is set to true.

example

___ = modifyRoute(c,modroute,options) uses the options structure to customize the output, which is useful to preconfigure and save your options for repeated use. The available options structure fields are timeOut and useDefaultEventHandler. Use the events output argument when the flag useDefaultEventHandler is set to true and omit this output argument when useDefaultEventHandler is set to false.

example

Examples

collapse all

To modify a route for a Bloomberg EMSX order:

  • Create the connection c using emsx.

  • Set up the order and route subscription using orders and routes.

  • Create and route the order using createOrderAndRoute.

For an example showing these activities, see Manage Bloomberg EMSX Order and Route.

Define the modroute structure that contains these fields:

  • Bloomberg EMSX order sequence number EMSX_SEQUENCE

  • Bloomberg EMSX ticker symbol EMSX_TICKER

  • Bloomberg EMSX number of shares EMSX_AMOUNT

  • Bloomberg EMSX route identifier EMSX_ROUTE_ID

This code instructs Bloomberg EMSX to route 100 shares of IBM® for order sequence number 731128 and route identifier 1. Convert the numbers to 32-bit signed integers using int32.

modroute.EMSX_SEQUENCE = int32(731128)
modroute.EMSX_TICKER = 'IBM';
modroute.EMSX_AMOUNT = int32(100);
modroute.EMSX_ROUTE_ID = int32(1);

Modify the route using the Bloomberg EMSX connection c and modroute.

events = modifyRoute(c,modroute)
events = 
    
    EMSX_SEQUENCE: 0
    EMSX_ROUTE_ID: 0
          MESSAGE: 'Route modified'

The default event handler processes the events associated with modifying a route. modifyRoute returns events as a structure that contains these fields:

  • Bloomberg EMSX order number

  • Bloomberg EMSX route identifier

  • Bloomberg EMSX message

Unsubscribe from order and route events using the Bloomberg EMSX subscription list objects osubs and rsubs. This code assumes that orders creates osubs and routes creates rsubs.

c.Session.unsubscribe(osubs)
c.Session.unsubscribe(rsubs)

Close the Bloomberg EMSX connection.

close(c)

To modify a route for a Bloomberg EMSX order:

  • Create the connection c using emsx.

  • Set up the order and route subscription using orders and routes.

  • Create and route the order using createOrderAndRoute.

For an example showing these activities, see Manage Bloomberg EMSX Order and Route.

Define the modroute structure that contains these fields:

  • Bloomberg EMSX order sequence number EMSX_SEQUENCE

  • Bloomberg EMSX ticker symbol EMSX_TICKER

  • Bloomberg EMSX number of shares EMSX_AMOUNT

  • Bloomberg EMSX route identifier EMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM for order sequence number 731128 and route identifier 1. Convert the numbers to 32-bit signed integers using int32.

modroute.EMSX_SEQUENCE = int32(731128)
modroute.EMSX_TICKER = 'IBM';
modroute.EMSX_AMOUNT = int32(100);
modroute.EMSX_ROUTE_ID = int32(1);

Modify the route using the Bloomberg EMSX connection c and modroute. Set the timeout value to 200 milliseconds.

events = modifyRoute(c,modroute,'timeOut',200)
events = 
    
    EMSX_SEQUENCE: 0
    EMSX_ROUTE_ID: 0
          MESSAGE: 'Route modified'

The default event handler processes the events associated with modifying a route. modifyRoute returns events as a structure that contains these fields:

  • Bloomberg EMSX order number

  • Bloomberg EMSX route identifier

  • Bloomberg EMSX message

Unsubscribe from order and route events using the Bloomberg EMSX subscription list objects osubs and rsubs. This code assumes that orders creates osubs and routes creates rsubs.

c.Session.unsubscribe(osubs)
c.Session.unsubscribe(rsubs)

Close the Bloomberg EMSX connection.

close(c)

To modify a route for a Bloomberg EMSX order:

  • Create the connection c using emsx.

  • Set up the order and route subscription using orders and routes.

  • Create and route the order using createOrderAndRoute.

For an example showing these activities, see Manage Bloomberg EMSX Order and Route.

Define the modroute structure that contains these fields:

  • Bloomberg EMSX order sequence number EMSX_SEQUENCE

  • Bloomberg EMSX ticker symbol EMSX_TICKER

  • Bloomberg EMSX number of shares EMSX_AMOUNT

  • Bloomberg EMSX route identifier EMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM for order sequence number 731128 and route identifier 1. Convert the numbers to 32-bit signed integers using int32.

modroute.EMSX_SEQUENCE = int32(731128)
modroute.EMSX_TICKER = 'IBM';
modroute.EMSX_AMOUNT = int32(100);
modroute.EMSX_ROUTE_ID = int32(1);

Suppose you create a custom event handler function called eventhandler with input argument c. Run eventhandler using timer. Start the timer to run eventhandler immediately using start. For details, see Writing and Running Custom Event Handler Functions.

t = timer('TimerFcn',{@c.eventhandler},'Period',1,...
          'ExecutionMode','fixedRate')
start(t)

t is the MATLAB® timer object. For details, see timer.

Modify the route using the Bloomberg EMSX connection c and modroute. Set the flag 'useDefaultEventHandler' to false so that eventhandler processes the events associated with modifying a route.

modifyRoute(c,modroute,'useDefaultEventHandler',false)

Unsubscribe from order and route events using the Bloomberg EMSX subscription list objects osubs and rsubs. This code assumes that orders creates osubs and routes creates rsubs. Stop the timer to stop data updates using stop.

c.Session.unsubscribe(osubs)
c.Session.unsubscribe(rsubs)
stop(t)

If you are done processing data updates, delete the timer using delete.

delete(t)

Close the Bloomberg EMSX connection.

close(c)

To modify a route for a Bloomberg EMSX order:

  • Create the connection c using emsx.

  • Set up the order and route subscription using orders and routes.

  • Create and route the order using createOrderAndRoute.

For an example showing these activities, see Manage Bloomberg EMSX Order and Route.

Define the modroute structure that contains these fields:

  • Bloomberg EMSX order sequence number EMSX_SEQUENCE

  • Bloomberg EMSX ticker symbol EMSX_TICKER

  • Bloomberg EMSX number of shares EMSX_AMOUNT

  • Bloomberg EMSX route identifier EMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM for order sequence number 731128 and route identifier 1. Convert the numbers to 32-bit signed integers using int32.

modroute.EMSX_SEQUENCE = int32(731128)
modroute.EMSX_TICKER = 'IBM';
modroute.EMSX_AMOUNT = int32(100);
modroute.EMSX_ROUTE_ID = int32(1);

Create a structure options. To use the default event handler, set the field useDefaultEventHandler to true. Set the field timeOut to 200 milliseconds. Modify the route using the Bloomberg EMSX connection c, modroute, and options structure options.

options.useDefaultEventHandler = true;
options.timeOut = 200;

events = modifyRoute(c,modroute,options)
events = 
    
    EMSX_SEQUENCE: 0
    EMSX_ROUTE_ID: 0
          MESSAGE: 'Route modified'

The default event handler processes the events associated with modifying a route. modifyRoute returns events as a structure that contains these fields:

  • Bloomberg EMSX order number

  • Bloomberg EMSX route identifier

  • Bloomberg EMSX message

Unsubscribe from order and route events using the Bloomberg EMSX subscription list objects osubs and rsubs. This code assumes that orders creates osubs and routes creates rsubs.

c.Session.unsubscribe(osubs)
c.Session.unsubscribe(rsubs)

Close the Bloomberg EMSX connection.

close(c)

Input Arguments

collapse all

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

Modify route request, specified as a structure with these fields.

Use getAllFieldMetaData to view all available fields for modroute. Convert the numbers to 32-bit signed integers using int32.

Field

Description

EMSX_SEQUENCE

Bloomberg EMSX order sequence number

EMSX_TICKER

Bloomberg EMSX ticker symbol

EMSX_AMOUNT

Bloomberg EMSX number of shares

EMSX_ROUTE_ID

Bloomberg EMSX route identifier

Example: modroute.EMSX_SEQUENCE = int32(731128);
modroute.EMSX_TICKER = 'XYZ';
modroute.EMSX_AMOUNT = int32(100);
modroute.EMSX_ROUTE_ID = int32(1);

Data Types: struct

Timeout value, specified as a nonnegative integer. This integer denotes the time, in milliseconds, that the event handler listens to the event queue for each iteration of the code. The event handler can be a default or custom event handler.

Data Types: double

Options for a custom event handler or timeout value, specified as a structure. To reuse the settings for specifying a custom event handler or timeout value for the event handler, use the options structure.

For example, specify using a custom event handler and a timeout value of 200 milliseconds.

options.useDefaultEventHandler = false;
options.timeOut = 200;

Data Types: struct

Output Arguments

collapse all

Event queue contents, returned as a double or structure.

If the event queue contains events, events is a structure containing the current contents of the event queue. Otherwise, events is an empty double.

Version History

Introduced in R2013a