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

The following is the list of all possible events on a FIXRegularOrder. Note all events are defined in FIXSessionOrderManager class instead of the FIXRegularOrder class.

Buy Side:

Event Description
NewOrderSending Gives the buy side application chance to further modify the message or prevent the order from being sent by throwing out an exception.
OrderCancelRequestSending Gives the buy side application chance to further modify the message or prevent the cancel from being sent by throwing out an exception.
OrderCancelRequestAdded An order cancel request is successfully added (accepted for now).
OrderReplaceRequestSending Gives the buy side application chance to further modify the message or prevent the replace from being sent by throwing out an exception.
OrderReplaceRequestAdded An order replace request is successfully added to the order (accepted for now).
OrderAdded An order is added (accepted for now).
DKAdded A DK message is added to the order.
OrderCancelRejectAdded A cancel reject is added (received) to the order.
ExecutionNewAdded An execution with status "New" is added.
ExecutionPendingNewAdded An execution with status "PendingNew" is added.
ExecutionPartiallyFilledAdded An execution with status "PartiallyFilled" is added.
ExecutionFilledAdded An execution with status "Filled" is added.
ExecutionCanceledAdded An execution with status "Canceled" is added.
ExecutionReplacedAdded An execution with status "Replaced" is added. The "Current Order" of the order also changed.
ExecutionPendingCancelAdded An execution with status "PendingCancel" is added.
ExecutionPendingReplaceAdded An execution with status "PendingReplace" is added.
ExecutionDoneForDayAdded An execution with status "DoneForDay" is added.
ExecutionStoppedNotificationAdded An execution with status "Stopped" is added. Note this is just a notification. The execution representing actual trade will follow.
ExecutionStoppedTradeAdded An execution with status "Stopped" is added. Note this is the actual trade following the "notification".
ExecutionRejectedAdded An execution with status "Rejected" is added. Note this is the actual trade following the "notification".
ExecutionSuspendedAdded An execution with status "Suspended" is added.
ExecutionCalculatedAdded An execution with status "Caculated" is added.
ExecutionExipredAdded An execution with status "Expired" is added.
ExecutionAcceptedForBiddingAdded An execution with status "AcceptedForBidding" is added.
ExecutionRestatedAdded An execution with status "Restated" is added.
ExecutionTransactionCanceled A bust execution that cancels a previous execution is added.
ExecutionTransactionCorrected A bust execution that corrects a previous execution is added.
StatusExecutionAdded A status execution is added.
ExecutionAdded An execution is added.
SessionRejectedOrder An order message is rejected at session level.
SessionRejectedCancel A cancel request is rejected at session level.
SessionRejectedReplace A replace request is rejected at session level.
SessionRejectedStatusRequest A status request is rejected at session level.
OrderUpdated The order is updated.

Sell Side:

Event Description
NewOrderReceived Gives the sell side application a chance to reject the order before it reaches to the higher level application by throwing out an exception.
OrderCancelRequestAdded Gives the sell side application a chance to cancel reject a cancel request by throwing out an exception.
OrderCancelRequestAdded An order cancel request is successfully added (accepted for now).
OrderReplaceRequestReceived Gives the sell side application a chance to cancel reject a replace request by throwing out an exception.
OrderReplaceRequestAdded An order replace request is successfully added to the order (accepted for now).
NewOrderAutoRejected An new order is automatically rejected on the sell side.
OrderAdded An order is added (accepted for now).
DKAdded A DK message is added to the order.
OrderCancelRejectAdded A cancel reject is added (received) to the order.
OrderStatusRequestAdded An order status request is added.
OrderAutoCancelRejected An cancel or cancel/replace request is automatically rejected by sell side.
ExecutionNewAdded An execution with status "New" is added.
ExecutionPendingNewAdded An execution with status "PendingNew" is added.
ExecutionPartiallyFilledAdded An execution with status "PartiallyFilled" is added.
ExecutionFilledAdded An execution with status "Filled" is added.
ExecutionCanceledAdded An execution with status "Canceled" is added.
ExecutionReplacedAdded An execution with status "Replaced" is added. The "Current Order" of the order also changed.
ExecutionPendingCancelAdded An execution with status "PendingCancel" is added.
ExecutionPendingReplaceAdded An execution with status "PendingReplace" is added.
ExecutionDoneForDayAdded An execution with status "DoneForDay" is added.
ExecutionStoppedNotificationAdded An execution with status "Stopped" is added. Note this is just a notification. The execution representing actual trade will follow.
ExecutionStoppedTradeAdded An execution with status "Stopped" is added. Note this is the actual trade following the "notification".
ExecutionRejectedAdded An execution with status "Rejected" is added. Note this is the actual trade following the "notification".
ExecutionSuspendedAdded An execution with status "Suspended" is added.
ExecutionCalculatedAdded An execution with status "Caculated" is added.
ExecutionExipredAdded An execution with status "Expired" is added.
ExecutionAcceptedForBiddingAdded An execution with status "AcceptedForBidding" is added.
ExecutionRestatedAdded An execution with status "Restated" is added.
ExecutionTransactionCanceled A bust execution that cancels a previous execution is added.
ExecutionTransactionCorrected A bust execution that corrects a previous execution is added.
StatusExecutionAdded A status execution is added.
ExecutionAdded An execution is added.
SessionRejectedExecution An execution message is rejected at session level.
SessionRejectedCxlReject A cancel reject is rejected at session level.
OrderUpdated The order is updated.

 

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:

ExecutionAdded is triggered after an execution report is added.

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, please see FIXRegularOrder class.