Main Content

modifyRouteWithStrat

ModifyBloombergEMSX route with strategies

Description

example

events= modifyRouteWithStrat(c,modroute,strat)modifies a Bloomberg®EMSX route with strategies using the Bloomberg EMSX connectionc, route requestmodroute, and order strategystratmodifyRouteWithStratreturns the order sequence number, route identifier, and status message using the default event handler.

example

events= modifyRouteWithStrat(c,modroute,strat,'timeOut',timeout)specifies a timeout valuetimeoutfor the execution of the default event handler.

example

modifyRouteWithStrat(___,'useDefaultEventHandler',false)modifies a Bloomberg EMSX route with strategies 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'totrueand use theeventsoutput argument. By default, the flag'useDefaultEventHandler'is set totrue

example

___= modifyRouteWithStrat(c,modroute,strat,options)uses theoptionsstructure to customize the output, which is useful to preconfigure and save your options for repeated use. The availableoptionsstructure fields aretimeOutanduseDefaultEventHandler。Use theeventsoutput argument when the flaguseDefaultEventHandleris set totrueand omit this output argument whenuseDefaultEventHandleris set tofalse

Examples

collapse all

To modify a route for a Bloomberg EMSX order with strategies:

  • Create the connectioncusingemsx

  • Set up the order and route subscription usingordersandroutes

  • Create and route the order usingcreateOrderAndRoute

For an example showing these activities, seeManage Bloomberg EMSX Order and Route

Define themodroutestructure that contains these fields:

  • Bloomberg EMSX order sequence numberEMSX_SEQUENCE

  • Bloomberg EMSX ticker symbolEMSX_TICKER

  • Bloomberg EMSX number of sharesEMSX_AMOUNT

  • Bloomberg EMSX route identifierEMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM®for order sequence number731128and route identifier1。Convert the numbers to 32-bit signed integers usingint32

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

Create the order strategies structurestratusing the strategySSP。Convert the field indicators to a 32-bit signed integer usingint32

strat.EMSX_STRATEGY_NAME ='SSP'; strat.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]); strat.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};

Modify the route using the Bloomberg EMSX connectionc,modroute, andstrat

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

The default event handler processes the events associated with modifying a route.modifyRouteWithStratreturnseventsas 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 objectsosubsandrsubs。This code assumes thatorderscreatesosubsandroutescreatesrsubs

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

Close the Bloomberg EMSX connection.

close(c)

To modify a route for a Bloomberg EMSX order with strategies:

  • Create the connectioncusingemsx

  • Set up the order and route subscription usingordersandroutes

  • Create and route the order usingcreateOrderAndRoute

For an example showing these activities, seeManage Bloomberg EMSX Order and Route

Define themodroutestructure that contains these fields:

  • Bloomberg EMSX order sequence numberEMSX_SEQUENCE

  • Bloomberg EMSX ticker symbolEMSX_TICKER

  • Bloomberg EMSX number of sharesEMSX_AMOUNT

  • Bloomberg EMSX route identifierEMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM for order sequence number731128and route identifier1。Convert the numbers to 32-bit signed integers usingint32

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

Create the order strategies structurestratusing the strategySSP。Convert the field indicators to a 32-bit signed integer usingint32

strat.EMSX_STRATEGY_NAME ='SSP'; strat.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]); strat.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};

Modify the route using the Bloomberg EMSX connectionc,modroute, andstrat。Set the timeout value to 200 milliseconds.

events = modifyRouteWithStrat(c,modroute,strat,'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.modifyRouteWithStratreturnseventsas 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 objectsosubsandrsubs。This code assumes thatorderscreatesosubsandroutescreatesrsubs

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

Close the Bloomberg EMSX connection.

close(c)

To modify a route for a Bloomberg EMSX order with strategies:

  • Create the connectioncusingemsx

  • Set up the order and route subscription usingordersandroutes

  • Create and route the order usingcreateOrderAndRoute

For an example showing these activities, seeManage Bloomberg EMSX Order and Route

Define themodroutestructure that contains these fields:

  • Bloomberg EMSX order sequence numberEMSX_SEQUENCE

  • Bloomberg EMSX ticker symbolEMSX_TICKER

  • Bloomberg EMSX number of sharesEMSX_AMOUNT

  • Bloomberg EMSX route identifierEMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM for order sequence number731128and route identifier1。Convert the numbers to 32-bit signed integers usingint32

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

Create the order strategies structurestratusing the strategySSP。Convert the field indicators to a 32-bit signed integer usingint32

strat.EMSX_STRATEGY_NAME ='SSP'; strat.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]); strat.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};

Suppose you create a custom event handler function calledeventhandlerwith input argumentc。Runeventhandlerusingtimer。Start the timer to runeventhandlerimmediately usingstart。For details, seeWriting and Running Custom Event Handler Functions

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

tis the MATLAB®timer object. For details, seetimer

Modify the route using the Bloomberg EMSX connectionc,modroute, andstrat。Set the flag'useDefaultEventHandler'tofalseso thateventhandlerprocesses the events associated with modifying a route.

modifyRouteWithStrat(c,modroute,strat,'useDefaultEventHandler',false)

Unsubscribe from order and route events using the Bloomberg EMSX subscription list objectsosubsandrsubs。This code assumes thatorderscreatesosubsandroutescreatesrsubs。Stop the timer to stop data updates usingstop

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

If you are done processing data updates, delete the timer usingdelete

delete(t)

Close the Bloomberg EMSX connection.

close(c)

To modify a route for a Bloomberg EMSX order with strategies:

  • Create the connectioncusingemsx

  • Set up the order and route subscription usingordersandroutes

  • Create and route the order usingcreateOrderAndRoute

For an example showing these activities, seeManage Bloomberg EMSX Order and Route

Define themodroutestructure that contains these fields:

  • Bloomberg EMSX order sequence numberEMSX_SEQUENCE

  • Bloomberg EMSX ticker symbolEMSX_TICKER

  • Bloomberg EMSX number of sharesEMSX_AMOUNT

  • Bloomberg EMSX route identifierEMSX_ROUTE_ID

This code modifies the route to 100 shares of IBM for order sequence number731128and route identifier1。Convert the numbers to 32-bit signed integers usingint32

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

Create the order strategies structurestratusing the strategySSP。Convert the field indicators to a 32-bit signed integer usingint32

strat.EMSX_STRATEGY_NAME ='SSP'; strat.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]); strat.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};

Create a structureoptions。To use the default event handler, set the fielduseDefaultEventHandlertotrue。Set the fieldtimeOutto 200 milliseconds. Modify the route using the Bloomberg EMSX connectionc,modroute,strat, and options structureoptions

options.useDefaultEventHandler = true; options.timeOut = 200; events = modifyRouteWithStrat(c,modroute,strat,options)
events = EMSX_SEQUENCE: 0 EMSX_ROUTE_ID: 0 MESSAGE: 'Route modified'

The default event handler processes the events associated with modifying a route.modifyRouteWithStratreturnseventsas 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 objectsosubsandrsubs。This code assumes thatorderscreatesosubsandroutescreatesrsubs

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 usingemsx

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

UsegetAllFieldMetaDatato view all available fields formodroute。Convert the numbers to 32-bit signed integers usingint32

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

Order strategies, specified as a structure that contains the fields:EMSX_STRATEGY_NAME,EMSX_STRATEGY_FIELD_INDICATORS, andEMSX_STRATEGY_FIELDS。字段值必须结合s结构trategy fields specified byEMSX_STRATEGY_NAME。For details about strategy fields and ordering, seegetBrokerInfo

ConvertEMSX_STRATEGY_FIELD_INDICATORSto a 32-bit signed integer usingint32。SetEMSX_STRATEGY_FIELD_INDICATORSequal to0for each field to use the field data setting inEMSX_FIELD_DATA。Or, setEMSX_STRATEGY_FIELD_INDICATORSequal to1to ignore the data inEMSX_FIELD_DATA

Example:strat.EMSX_STRATEGY_NAME = 'SSP';
strat.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]);
strat.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};

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

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,eventsis a structure containing the current contents of the event queue. Otherwise,eventsis an empty double.

Version History

Introduced in R2013a