Documentation Center

  • Trial Software
  • Product Updates

createOrderAndRoute

Create and route Bloomberg EMSX order

Syntax

  • R = createOrderAndRoute(c,reqStruct) example
  • R = createOrderAndRoute(c,reqStruct,Name,Value) example

Description

example

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

example

R = createOrderAndRoute(c,reqStruct,Name,Value) uses additional options specified by one or more Name, Value pair arguments. Create and route a Bloomberg EMSX order with 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;
     p.useDefaultEventHandler = false;
     createOrderAndRoute(c,reqStruct,p)
     c.processEvent

Examples

expand all

Create and Route Bloomberg EMSX Order Using Default Event Handler

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

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';
reqStruct.EMSX_SIDE = 'BUY';
r = createOrderAndRoute(c,reqStruct)
  r = 
    
    EMSX_SEQUENCE: 335877
    EMSX_ROUTE_ID: 1
          MESSAGE: 'Order created and routed' 

Create and Route Bloomberg EMSX Order Using Custom Event Handler

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

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';
reqStruct.EMSX_SIDE = 'BUY'; 
createOrderAndRoute(c,reqStruct,'useDefaultEventHandler',false)
processEvent(c)
 CreateOrderAndRoute = {
 
     EMSX_SEQUENCE = 335877
 
     EMSX_ROUTE_ID = 1
 
     MESSAGE = Order created and routed
 
     }

Create and Route Bloomberg EMSX Order Using timeOut Value

Define the order request structure. Then create and route the order and assign a timeOut value of 200 milliseconds.

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';
reqStruct.EMSX_SIDE = 'BUY'; 
createOrderAndRoute(c,reqStruct,'timeOut',200)
 r = 
    
    EMSX_SEQUENCE: 335877
    EMSX_ROUTE_ID: 1
          MESSAGE: 'Order created and 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

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

Example: reqStruct.EMSX_TICKER = 'XYZ';
reqStruct.EMSX_AMOUNT = int32(100);
reqStruct.EMSX_ORDER_TYPE = 'MKT';
reqStruct.EMSX_TIF = 'DAY';
reqStruct.EMSX_HAND_INSTRUCTION = 'ANY';
reqStruct.EMSX_SIDE = 'BUY';

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: createOrderAndRoute(c,reqStruct,'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?