Documentation Center

  • Trial Software
  • Product Updates

routeOrderWithStrat

Route Bloomberg EMSX order with strategies

Syntax

  • R = routeOrderWithStrat(c,reqStruct,stratStruct) example
  • R = routeOrderWithStrat(c,reqStruct,stratStruct,Name,Value) example

Description

example

R = routeOrderWithStrat(c,reqStruct,stratStruct) routes a Bloomberg® EMSX order with strategies and returns the order sequence number, route ID, and status message using the default event handler.

example

R = routeOrderWithStrat(c,reqStruct,stratStruct,Name,Value) uses additional options specified by one or more Name, Value pair arguments. Route a Bloomberg EMSX order with strategies using optional name-value arguments to specify a custom event handler or timeout value for the event handler.

    Note:   Name-value pair arguments can be input as a single input structure containing some or all of the property fields, for example:

    p.timeOut = 1000;
    routeOrderWithStrat(c,reqStruct,stratStruct,p)
    

Examples

expand all

Route Bloomberg EMSX Order with Strategies Using Default Event Handler

Define the order request structure and strategies structure and then route the order.

reqStruct.EMSX_SEQUENCE = int32(335877);
reqStruct.EMSX_TICKER = 'XYZ';
reqStruct.EMSX_AMOUNT = int32(100);
reqStruct.EMSX_ORDER_TYPE = 'MKT';
reqStruct.EMSX_BROKER = 'BB';
reqStruct.EMSX_TIF = 'DAY';
reqStruct.EMSX_HAND_INSTRUCTION = 'ANY';
stratStruct.EMSX_STRATEGY_NAME = 'SSP';
stratStruct.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]);
stratStruct.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};
 r = routeOrderWithStrat(c,reqStruct,stratStruct)
 r = 
 
     EMSX_SEQUENCE: 335877
     EMSX_ROUTE_ID: 1
           MESSAGE: 'Order Routed'

Route Bloomberg EMSX Order with Strategies Using Custom Event Handler

Define the order request structure and strategies structure and then route the order.

reqStruct.EMSX_SEQUENCE = int32(335877);
reqStruct.EMSX_TICKER = 'XYZ';
reqStruct.EMSX_AMOUNT = int32(100);
reqStruct.EMSX_ORDER_TYPE = 'MKT';
reqStruct.EMSX_BROKER = 'BB';
reqStruct.EMSX_TIF = 'DAY';
reqStruct.EMSX_HAND_INSTRUCTION = 'ANY';
stratStruct.EMSX_STRATEGY_NAME = 'SSP';
stratStruct.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]);
stratStruct.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};
routeOrderWithStrat(c,reqStruct,stratStruct,'useDefaultEventHandler',false)
processEvent(c)
 Route = {
 
     EMSX_SEQUENCE = 335877
 
     EMSX_ROUTE_ID = 1
     
     MESSAGE = Order Routed
 
     }

Route Bloomberg EMSX Order with Strategies Using timeOut Value

Define the order request structure and strategies structure and then route the order.

reqStruct.EMSX_SEQUENCE = int32(335877);
reqStruct.EMSX_TICKER = 'XYZ';
reqStruct.EMSX_AMOUNT = int32(100);
reqStruct.EMSX_ORDER_TYPE = 'MKT';
reqStruct.EMSX_BROKER = 'BB';
reqStruct.EMSX_TIF = 'DAY';
reqStruct.EMSX_HAND_INSTRUCTION = 'ANY';
stratStruct.EMSX_STRATEGY_NAME = 'SSP';
stratStruct.EMSX_STRATEGY_FIELD_INDICATORS = int32([0 0 0]);
stratStruct.EMSX_STRATEGY_FIELDS = {'09:30:00','14:30:00',50};
routeOrderWithStrat(c,reqStruct,stratStruct,'timeOut',200)
 r = 
 
     EMSX_SEQUENCE: 335877
     EMSX_ROUTE_ID: 1
           MESSAGE: 'Order Routed'

Input Arguments

expand all

c — Connection object for Bloomberg EMSX serviceobject structure

Connection object for Bloomberg EMSX service, specified using emsx.

reqStruct — Order request structurestructure | integer for EMSX_SEQUENCE number

Order request structure, specified using EMSX field properties. Use getAllFieldMetaData to view all available field property options for reqStruct.

    Note:   EMSX_SEQUENCE must denote an existing order sequence number.

Example: reqStruct.EMSX_SEQUENCE = int32(335877);
reqStruct.EMSX_TICKER = 'XYZ';
reqStruct.EMSX_AMOUNT = int32(100);
reqStruct.EMSX_ORDER_TYPE = 'MKT';

Data Types: int32 | struct

stratStruct — Order strategies structurestructure

Order strategies structure specified by the elements of the fields EMSX_STRATEGY_FIELD_INDICATORS and EMSX_STRATEGY_FIELDS in the stratStruct. In addition, the field elements of stratStruct must align with the fields for the strategy specified by STRATSTRUCT.EMSX_STRATEGY_NAME. For more information on strategy fields and ordering, see getBrokerInfo.

When using stratStruct, set STRATSTRUCT.EMSX_STRATEGY_FIELD_INDICATORS equal to 0 for each field so that the field data setting in STRATSTRUCT.EMSX_FIELD_DATA is used. Also set STRATSTRUCT.EMSX_STRATEGY_FIELD_INDICATORS equal to 1 to ignore the data in STRATSTRUCT.EMSX_FIELD_DATA.

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

Data Types: struct

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: routeOrderWithStrat(c,reqStruct,stratStruct,'useDefaultEventHandler',false)

'useDefaultEventHandler' — Flag for event handler preferencetrue (default) | logical with value true or false

Flag for event handler preference, indicating whether to use the default or custom event handler to process order events, as specified by the string true or false. When this flag is set to the default, true, the default event handler is used. If a custom event handler is used, this flag must be set to false.

Example: 'useDefaultEventHandler',false

Data Types: logical

'timeOut' — Connection timeout value for event handler for Bloomberg EMSX service500 milliseconds (default) | nonnegative integer

Connection timeout value, specified as a nonnegative integer in units of milliseconds.

Example: 'timeOut',200

Data Types: char

Output Arguments

expand all

R — Return status for order eventstructure

Return status for the order event, returned as a structure.

See Also

| | | | | |

Was this topic helpful?