The latest information about the order (such as CumQty, AvgPx etc) should be retrieved from the last execution report.
Note: The last execution might be null, which means that the system has not received any execution against the order yet.
For more information about thread safety, please read "Thread Safety".
// Prerequisites: Variable "order" of type FIXRegularOrder. FIXMessageComponent lastExecMsg = order.LastExecution; double cumQty; double avgPx; if (lastExecMsg == null) { cumQty = avgPx = 0; } else { cumQty = lastExecMsg.GetFloatValue(Tags.CumQty); avgPx = lastExecMsg.GetFloatValue(Tags.AvgPx); } // Now we have the latest cumQty and avgPx;
Note: The FIXRegularOrder.OrdStatus might be a more reliable way to retrieve the "real" order status. For example, if the order is currently partially filled and the application sent out an order cancel/replace. The "OrdStatus" from the execution message may be "Pending Replace". However, the FIXRegularOrder.OrdStatus will still be "PartiallyFilled".
This example works with FIX versions from 4.1 to 5.0+.