Main Content

groupRouteOrder

Route group ofBloombergEMSX orders

Description

example

events= groupRouteOrder(c,order)routes a group of Bloomberg®EMSX orders using the Bloomberg EMSX connection with the Bloomberg EMSX C++ interface and order request.groupRouteOrderreturns the order sequence number and status message using the default event handler.

example

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

example

groupRouteOrder(___,'useDefaultEventHandler',false)routes a group of Bloomberg EMSX orders using any of the previous input argument combinations and a custom event handler function. Write a custom event handler to process the events associated with routing a group of orders. This syntax does not have an output argument because the custom event handler processes the contents of the event queue.

example

___= groupRouteOrder(c,order,options)uses theoptionsstructure to customize the output, which is useful for configuring and saving your options for repeated use. The availableoptionsstructure fields aretimeOutanduseDefaultEventHandler。Use theeventsoutput argument when theuseDefaultEventHandlerfield is set totrue, and omit this output argument when theuseDefaultEventHandlerfield is set tofalse

Examples

collapse all

Using a Bloomberg EMSX connection, route a group of Bloomberg EMSX orders.

To create a Bloomberg EMSX order, create the connectioncusingemsxand set up the order subscription usingorders。一个例子显示这些活动,看到Create and Manage Bloomberg EMSX Order Using Bloomberg EMSX C++ Interface

Create the order request structureorder1to define the order parameters. In this case, the code creates a buy market order for 100 shares of IBM®。The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order1.EMSX_TICKER ='IBM'; order1.EMSX_AMOUNT = int32(100); order1.EMSX_ORDER_TYPE ='MKT'; order1.EMSX_BROKER ='BB'; order1.EMSX_TIF ='DAY'; order1.EMSX_HAND_INSTRUCTION ='ANY'; order1.EMSX_SIDE ='BUY';

Create the order using the Bloomberg EMSX connectioncandorder1

events = createOrder(c,order1)
events = struct with fields: EMSX_SEQUENCE: 354646 MESSAGE: 'Order created'

The default event handler processes the events associated with creating the order.createOrderreturnseventsas a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order number

  • MESSAGE— Bloomberg EMSX message

Create another order request structureorder2to define the order parameters. In this case, the code creates a buy market order for 200 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order2.EMSX_TICKER ='IBM'; order2.EMSX_AMOUNT = int32(200); order2.EMSX_ORDER_TYPE ='MKT'; order2.EMSX_BROKER ='BB'; order2.EMSX_TIF ='DAY'; order2.EMSX_HAND_INSTRUCTION ='ANY'; order2.EMSX_SIDE ='BUY';

Create the second order using the Bloomberg EMSX connectioncandorder2

events = createOrder(c,order2)
events = struct with fields: EMSX_SEQUENCE: 354777 MESSAGE: 'Order created'

Route the two existing orders. Specify the order numbers, broker, and hand instruction in theorderstructure.

order.EMSX_SEQUENCE{1} = int32(354646); order.EMSX_SEQUENCE{2} = int32(354777); order.EMSX_BROKER ='BB'; order.EMSX_HAND_INSTRUCTION ='ANY'; events = groupRouteOrder(c,order)
events = struct with fields: EMSX_SEQUENCE: 354646 EMSX_ROUTE_ID: 1 MESSAGE: 'Order Routed'

The default event handler processes the events associated with routing a group of orders.eventsis a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order numbers

  • EMSX_ROUTE_ID— Bloomberg EMSX route identifier

  • MESSAGE— Bloomberg EMSX message

Close the Bloomberg EMSX connection.

close(c)

Using a Bloomberg EMSX connection, route a group of Bloomberg EMSX orders. Specify a timeout value.

To create a Bloomberg EMSX order, create the connectioncusingemsxand set up the order subscription usingorders。一个例子显示这些活动,看到Create and Manage Bloomberg EMSX Order Using Bloomberg EMSX C++ Interface

Create the order request structureorder1to define the order parameters. In this case, the code creates a buy market order for 100 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order1.EMSX_TICKER ='IBM'; order1.EMSX_AMOUNT = int32(100); order1.EMSX_ORDER_TYPE ='MKT'; order1.EMSX_BROKER ='BB'; order1.EMSX_TIF ='DAY'; order1.EMSX_HAND_INSTRUCTION ='ANY'; order1.EMSX_SIDE ='BUY';

Create the order using the Bloomberg EMSX connectioncandorder1

events = createOrder(c,order1)
events = struct with fields: EMSX_SEQUENCE: 354646 MESSAGE: 'Order created'

The default event handler processes the events associated with creating the order.createOrderreturnseventsas a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order number

  • MESSAGE— Bloomberg EMSX message

Create another order request structureorder2to define the order parameters. In this case, the code creates a buy market order for 200 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order2.EMSX_TICKER ='IBM'; order2.EMSX_AMOUNT = int32(200); order2.EMSX_ORDER_TYPE ='MKT'; order2.EMSX_BROKER ='BB'; order2.EMSX_TIF ='DAY'; order2.EMSX_HAND_INSTRUCTION ='ANY'; order2.EMSX_SIDE ='BUY';

Create the second order using the Bloomberg EMSX connectioncandorder2

events = createOrder(c,order2)
events = struct with fields: EMSX_SEQUENCE: 354777 MESSAGE: 'Order created'

Route the two existing orders. Specify the order numbers, broker, and hand instruction in theorderstructure. Specify an additional option for a timeout value of 200 milliseconds by using the'timeOut'flag.

order.EMSX_SEQUENCE{1} = int32(354646); order.EMSX_SEQUENCE{2} = int32(354777); order.EMSX_BROKER ='BB'; order.EMSX_HAND_INSTRUCTION ='ANY'; events = groupRouteOrder(c,order,'timeOut',200)
events = struct with fields: EMSX_SEQUENCE: 354646 EMSX_ROUTE_ID: 1 MESSAGE: 'Order Routed'

eventsis a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order numbers

  • EMSX_ROUTE_ID— Bloomberg EMSX route identifier

  • MESSAGE— Bloomberg EMSX message

Close the Bloomberg EMSX connection.

close(c)

Using a Bloomberg EMSX connection, route a group of Bloomberg EMSX orders. Specify using a custom event handler function to process the events.

To create a Bloomberg EMSX order, create the connectioncusingemsxand set up the order subscription usingorders。一个例子显示这些活动,看到Create and Manage Bloomberg EMSX Order Using Bloomberg EMSX C++ Interface

Create the order request structureorder1to define the order parameters. In this case, the code creates a buy market order for 100 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order1.EMSX_TICKER ='IBM'; order1.EMSX_AMOUNT = int32(100); order1.EMSX_ORDER_TYPE ='MKT'; order1.EMSX_BROKER ='BB'; order1.EMSX_TIF ='DAY'; order1.EMSX_HAND_INSTRUCTION ='ANY'; order1.EMSX_SIDE ='BUY';

Create the order using the Bloomberg EMSX connectioncandorder1

events = createOrder(c,order1)
events = struct with fields: EMSX_SEQUENCE: 354646 MESSAGE: 'Order created'

The default event handler processes the events associated with creating the order.createOrderreturnseventsas a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order number

  • MESSAGE— Bloomberg EMSX message

Create another order request structureorder2to define the order parameters. In this case, the code creates a buy market order for 200 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order2.EMSX_TICKER ='IBM'; order2.EMSX_AMOUNT = int32(200); order2.EMSX_ORDER_TYPE ='MKT'; order2.EMSX_BROKER ='BB'; order2.EMSX_TIF ='DAY'; order2.EMSX_HAND_INSTRUCTION ='ANY'; order2.EMSX_SIDE ='BUY';

Create the second order using the Bloomberg EMSX connectioncandorder2

events = createOrder(c,order2)
events = struct with fields: EMSX_SEQUENCE: 354777 MESSAGE: 'Order created'

Route the two existing orders. Specify the order numbers, broker, and hand instruction in theorderstructure. Use a custom event handler function to process the events. You can use the sample event handler functionprocessEventor write your own custom event handler function. For this example, useprocessEventto process the events.

order.EMSX_SEQUENCE{1} = int32(354646); order.EMSX_SEQUENCE{2} = int32(354777); order.EMSX_BROKER ='BB'; order.EMSX_HAND_INSTRUCTION ='ANY'; groupRouteOrder(c,order,'useDefaultEventHandler',false) processEvent(c)
Route = { EMSX_SEQUENCE = 354646 EMSX_ROUTE_ID = 1 MESSAGE = 'Order Routed' }

Close the Bloomberg EMSX connection.

close(c)

Using a Bloomberg EMSX connection, route a group of Bloomberg EMSX orders. Specify an additional option for a timeout value by using a structure.

To create a Bloomberg EMSX order, create the connectioncusingemsxand set up the order subscription usingorders。一个例子显示这些活动,看到Create and Manage Bloomberg EMSX Order Using Bloomberg EMSX C++ Interface

Create the order request structureorder1to define the order parameters. In this case, the code creates a buy market order for 100 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order1.EMSX_TICKER ='IBM'; order1.EMSX_AMOUNT = int32(100); order1.EMSX_ORDER_TYPE ='MKT'; order1.EMSX_BROKER ='BB'; order1.EMSX_TIF ='DAY'; order1.EMSX_HAND_INSTRUCTION ='ANY'; order1.EMSX_SIDE ='BUY';

Create the order using the Bloomberg EMSX connectioncandorder1

events = createOrder(c,order1)
events = struct with fields: EMSX_SEQUENCE: 354646 MESSAGE: 'Order created'

The default event handler processes the events associated with creating the order.createOrderreturnseventsas a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order number

  • MESSAGE— Bloomberg EMSX message

Create another order request structureorder2to define the order parameters. In this case, the code creates a buy market order for 200 shares of IBM. The code uses the brokerBBwith the time in force set toDAYand any hand instruction. Convert the number of shares to a 32-bit signed integer usingint32

order2.EMSX_TICKER ='IBM'; order2.EMSX_AMOUNT = int32(200); order2.EMSX_ORDER_TYPE ='MKT'; order2.EMSX_BROKER ='BB'; order2.EMSX_TIF ='DAY'; order2.EMSX_HAND_INSTRUCTION ='ANY'; order2.EMSX_SIDE ='BUY';

Create the second order using the Bloomberg EMSX connectioncandorder2

events = createOrder(c,order2)
events = struct with fields: EMSX_SEQUENCE: 354777 MESSAGE: 'Order created'

Route the two existing orders. Specify the order numbers, broker, and hand instruction in theorderstructure. Specify an additional option for a timeout value of 200 milliseconds by using theoptionsstructure.

order.EMSX_SEQUENCE{1} = int32(354646); order.EMSX_SEQUENCE{2} = int32(354777); order.EMSX_BROKER ='BB'; order.EMSX_HAND_INSTRUCTION ='ANY'; options.timeOut = 200; events = groupRouteOrder(c,order,options)
events = struct with fields: EMSX_SEQUENCE: 354646 EMSX_ROUTE_ID: 1 MESSAGE: 'Order Routed'

eventsis a structure that contains these fields:

  • EMSX_SEQUENCE— Bloomberg EMSX order numbers

  • EMSX_ROUTE_ID— Bloomberg EMSX route identifier

  • MESSAGE— Bloomberg EMSX message

Close the Bloomberg EMSX connection.

close(c)

Input Arguments

collapse all

Bloomberg EMSX service connection, specified as abloombergEMSXobject.

Order request, specified as a structure that contains these fields:

  • EMSX_SEQUENCE— Order numbers

  • EMSX_BROKER— Broker

  • EMSX_HAND_INSTRUCTION— Hand instruction

Convert the order numbers to a 32-bit signed integer by usingint32

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 R2021a