FIXRegularOrder Event Model

FIXRegularOrder is the most commonly used class in Order Manager, probably the most important class also.

FIXRegularOrder can be used to represent a single order or a multileg order directly. The single order in a list order or side order in a cross order are also populated into FIXRegularOrder. In fact, the list component or cross side are reported as single orders using "Execution Report" messages in FIX specification.

 

FIXRegularOrder Event Model in Detail

 FIXSessionOrderManager generates events for changes of each FIXRegularOrder managed by the session.

As we mentioned in previous chapter, the folowing listeners are defined: FIXSessionOrderManagerBuySideListener, FIXSessionOrderManagerSellSideListener, FIXSessionOrderManagerCommonListener, FIXSessionOrderManagerExecutionListener, FIXSessionOrderManagerSimplifiedListener, and FIXSessionOrderManagerSessionRejectListener. Check the API documentation for further details.

 

Execution Handling - Why So Many Events?

We define a event for every execution status change. Why do we have to do that?

One reason is that some times it's very tedious for programmers to tell the exact order status change from executions. For example, in FIX 4.0 and 4.1, there is no "Pending Replace", "Pending Cancel" will be sent in response to both "Cancel Request" and "Replace Request". There also exists ambiguity with "Stopped" executions for guaranteed executions. The only way to tell whether or not it is the actual trade is to compare the "CumQty".

Another reason is, it is extremely easy to implement an order routing gateway with the current event model.

 

Simplified Event Model

Please note for most of the applications, there is really no need to go into every details for every execution status. For example, a buy side may only be interested in the trade executions and the status of cancel request or replace requests. For those types of paplications, we provide simplified events.

There are two simplified events:

FIXSessionOrderManagerSimplifiedListener.executionAdded is triggered after an execution report is added.

FIXSessionOrderManagerSimplifiedListener.orderUpdated is triggered after a new message (order modification ,execution, cancel reject etc etc.) is added to the order.

 

Methods

Applications use events to receive updates of order status from the other side. Order Manager also provides methods for applications to manipulate the order.

Usually, an application calls a method to "send" a message. And an event will be triggered when a message is "received".

Buy Side:

Method Description
addNewRegularOrder() Adds a new regular order to the order manager. The order message will be sent before the method returns.
addNewCrossOrder() Adds a new cross order to the order manager. The order message will be sent before the method returns.
addNewListOrder() Adds a new list order to the order manager. The order messages will be sent before the method returns.
createOrderCancelRequest() Creates an order cancel request message based on the type of the order. Note application needs to fill some additional fields.
addOrderCancelRequest() Adds an order cancel request to the order. The messages will be sent before the method returns.
createOrderReplaceRequest() Creates an order replace request message based on the type of the order. Note application needs to fill some additional fields.
addOrderReplaceRequest() Adds an order replace request to the order. The messages will be sent before the method returns.
createOrderStatusRequest() Creates an order status request message based on the type of the order. Note application needs to fill some additional fields.
addOrderStatusRequest() Adds an order status request to the order. The messages will be sent before the method returns.

Sell Side:

Method Description
createOrderCancelReject() Creates an order cancel reject message.
addCancelReject() Adds an order cancel reject to the order. The messages will be sent before the method returns.
addExecution() Adds an execution report to the order. The messages will be sent before the method returns.

For more information about methods, please see FIXRegularOrder class.