Event handlers of execution report messages can be specified by session.
// Prerequisites: Variable "session" of type FIXSession. FIXSessionOrderManager sessionOM = FIXOrderManager.GetSessionOrderManager(session); // Event handlers can be added in response to specific type of execution // For example: "Partially filled execution" sessionOM.ExecutionPartiallyFilledAdded += new OrderExecutionEventHandler(sessionOM_ExecutionPartiallyFilledAdded); // Or "Filled execution" sessionOM.ExecutionFilledAdded += new OrderExecutionEventHandler(sessionOM_ExecutionFilledAdded); // Or most commonly, use the "simplified model" to add a handler for "any" execution message sessionOM.ExecutionAdded += new OrderExecutionEventHandler(sessionOM_ExecutionAdded);
The parameters of the call back contains enough information about the current execution message, even with the "most simplified" model.
static void sessionOM_ExecutionAdded(FIXRegularOrder order, FIXMessage executionMessage, FIXOrderManagerOrderChanges changes, FIXEngineMessageHandlerStatus status) { // Use the code snippet below to inspect the changes triggered by the current execution message. if ((changes & FIXOrderManagerOrderChanges.CumQtyIncreased) != 0) { // TODO: Add your own business logic here. } // Or if ((changes & FIXOrderManagerOrderChanges.OrdStatusChanged) != 0) { // TODO: Add your own business logic here. } // Or if ((changes & FIXOrderManagerOrderChanges.InternalIgnore) != 0) { // TODO: Add your own business logic here. } // For more information, see FIXOrderManagerOrderChanges. }
This example works with FIX versions from 4.1 to 5.0+.