deleteRoute

Delete Bloomberg EMSX active shares

Syntax

  • events = deleteRoute(c,routenum) example
  • events = deleteRoute(c,routenum,'timeOut',timeout) example
  • deleteRoute(___,'useDefaultEventHandler',false) example
  • ___ = deleteRoute(c,routenum,options) example

Description

example

events = deleteRoute(c,routenum) deletes the active shares that are routed but not filled using the Bloomberg® EMSX connection c and route number routenum. deleteRoute returns a status message using the default event handler.

example

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

example

deleteRoute(___,'useDefaultEventHandler',false) deletes the active shares that are routed but not filled 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 deleting the active shares. 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

___ = deleteRoute(c,routenum,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 useDefaultEventHandler is set to true and omit this output argument when useDefaultEventHandler is set to false.

Examples

expand all

Delete Active Shares

To delete the active shares that are routed but not filled for a Bloomberg EMSX order:

  1. Create the connection c using emsx.

  2. Set up an order and route subscription using orders and routes.

  3. Create and route an order using createOrderAndRoute.

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

Define the structure routenum that contains the order sequence number EMSX_SEQUENCE for the routed order and route number EMSX_ROUTE_ID.

routenum.EMSX_SEQUENCE = 335877;
routenum.EMSX_ROUTE_ID = 1;

Delete the active shares that are routed but not filled using the Bloomberg EMSX connection c and routenum.

events = deleteRoute(c,routenum)
events = 

     STATUS: '1'
    MESSAGE: 'Route cancellation request sent to broker'

The default event handler processes the events associated with deleting the active shares. deleteRoute returns events as a structure that contains these fields:

  • Bloomberg EMSX status

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

b.Session.unsubscribe(osubs)
b.Session.unsubscribe(rsubs)

Close the Bloomberg EMSX connection.

close(c)

Delete Active Shares Using a Timeout

To delete the active shares that are routed but not filled for a Bloomberg EMSX order:

  1. Create the connection c using emsx.

  2. Set up an order and route subscription using orders and routes.

  3. Create and route an order using createOrderAndRoute.

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

Define the structure routenum that contains the order sequence number EMSX_SEQUENCE for the routed order and route number EMSX_ROUTE_ID.

routenum.EMSX_SEQUENCE = 335877;
routenum.EMSX_ROUTE_ID = 1;

Delete the active shares that are routed but not filled using the Bloomberg EMSX connection c and routenum. Set the timeout value to 200 milliseconds. timeOut specifies how long the event handler listens to the queue for an event for each iteration of the code.

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

events = deleteRoute(c,routenum,'timeOut',200)
events = 

     STATUS: '1'
    MESSAGE: 'Route cancellation request sent to broker'

The default event handler processes the events associated with deleting the active shares. deleteRoute returns events as a structure that contains these fields:

  • Bloomberg EMSX status

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

b.Session.unsubscribe(osubs)
b.Session.unsubscribe(rsubs)

Close the Bloomberg EMSX connection.

close(c)

Delete Active Shares Using a Custom Event Handler

To delete the active shares that are routed but not filled for a Bloomberg EMSX order:

  1. Create the Bloomberg EMSX connection c using emsx.

  2. Set up an order and route subscription using orders and routes.

  3. Create and route an order using createOrderAndRoute.

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

Define the structure routenum that contains the order sequence number EMSX_SEQUENCE for the routed order and route number EMSX_ROUTE_ID.

routenum.EMSX_SEQUENCE = 335877;
routenum.EMSX_ROUTE_ID = 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',{@eventhandler,c},'Period',1,...
          'ExecutionMode','fixedRate')
start(t)

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

Delete the active shares that are routed but not filled using the Bloomberg EMSX connection c and routenum. Set the flag 'useDefaultEventHandler' to false so that eventhandler processes the events associated with deleting the active shares.

deleteRoute(c,routenum,'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.

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

Delete the timer if you are done processing data updates using delete.

delete(t)

Close the Bloomberg EMSX connection.

close(c)

Delete Active Shares Using an Options Structure

To delete the active shares that are routed but not filled for a Bloomberg EMSX order:

  1. Create the connection c using emsx.

  2. Set up an order and route subscription using orders and routes.

  3. Create and route an order using createOrderAndRoute.

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

Define the structure routenum that contains the order sequence number EMSX_SEQUENCE for the routed order and route number EMSX_ROUTE_ID.

routenum.EMSX_SEQUENCE = 335877;
routenum.EMSX_ROUTE_ID = 1;

Create a structure options. To use the default event handler, set the field useDefaultEventHandler to true. Set the field timeOut to 200 milliseconds. timeOut specifies how long the event handler listens to the queue for an event for each iteration of the code. Delete the active shares that are routed but not filled using the Bloomberg EMSX connection c, routenum, and options structure options.

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

events = deleteRoute(c,routenum,options)
events = 

     STATUS: '1'
    MESSAGE: 'Route cancellation request sent to broker'

The default event handler processes the events associated with deleting the active shares. deleteRoute returns events as a structure that contains these fields:

  • Bloomberg EMSX status

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

b.Session.unsubscribe(osubs)
b.Session.unsubscribe(rsubs)

Close the Bloomberg EMSX connection.

close(c)

Input Arguments

expand all

c — Bloomberg EMSX service connectionconnection object

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

routenum — Route to deletestructure

Route to delete, specified as a structure containing fields EMSX_SEQUENCE and EMSX_ROUTE_ID.

Example: routenum.EMSX_SEQUENCE = 728918;
routenum.EMSX_ROUTE_ID = 1;

Data Types: struct

timeout — Timeout value500 milliseconds (default) | nonnegative integer

Timeout value, specified as a nonnegative integer to denote the time in milliseconds the default or custom event handler waits for an event in the current queue.

Data Types: double

options — Options for custom event handler or timeout valuestructure

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

Specify using a custom event handler and a timeout value of 500 milliseconds.

Example: options.useDefaultEventHandler = false;
options.timeOut = 500;

Data Types: struct

Output Arguments

expand all

events — Event queue contentsdouble | structure

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.

More About

expand all

Tips

For details about Bloomberg EMSX, see the EMSX API Programmer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Was this topic helpful?