/// <summary> /// Makes an execution object /// </summary> /// <param name="executionReport"></param> /// <returns></returns> private Execution PopulateExecution(QuickFix.FIX43.ExecutionReport executionReport) { string orderSide = FixCommon.Converter.ConvertOrderSide.GetLocalOrderSide(executionReport.Side.getValue()); // Extract Fill information Fill fill = new Fill(new Security { Symbol = executionReport.Symbol.getValue() }, _provider, executionReport.ClOrdID.getValue()) { ExecutionDateTime = executionReport.TransactTime.getValue(), ExecutionType = executionReport.ExecType.getValue() == ExecType.FILL ? Constants.ExecutionType.Fill : Constants.ExecutionType.Partial, ExecutionId = executionReport.ExecID.getValue(), ExecutionPrice = Convert.ToDecimal(executionReport.AvgPx.getValue(), CultureInfo.InvariantCulture), ExecutionSize = Convert.ToInt32(executionReport.LastQty.getValue()), ExecutionSide = orderSide, AverageExecutionPrice = Convert.ToDecimal(executionReport.AvgPx.getValue(), CultureInfo.InvariantCulture), LeavesQuantity = Convert.ToInt32(executionReport.LeavesQty.getValue(), CultureInfo.InvariantCulture), CummalativeQuantity = Convert.ToInt32(executionReport.CumQty.getValue(), CultureInfo.InvariantCulture) }; // Extract Order information Order order = new Order(_provider) { OrderID = executionReport.ClOrdID.getValue(), OrderSide = orderSide, OrderSize = Convert.ToInt32(executionReport.OrderQty.getValue(), CultureInfo.InvariantCulture), OrderTif = FixCommon.Converter.ConvertTif.GetLocalValue(executionReport.TimeInForce.getValue()) }; return(new Execution(fill, order)); }
/// <summary> /// Makes an order object /// </summary> /// <param name="executionReport"></param> /// <returns></returns> private Order PopulateOder(QuickFix.FIX43.ExecutionReport executionReport) { string orderSide = FixCommon.Converter.ConvertOrderSide.GetLocalOrderSide(executionReport.Side.getValue()); // Extract Order information Order order = new Order(_provider) { OrderID = executionReport.ExecType.getValue().Equals(ExecType.NEW) ? executionReport.ClOrdID.getValue() : executionReport.OrigClOrdID.getValue(), OrderSide = orderSide, OrderSize = Convert.ToInt32(executionReport.OrderQty.getValue(), CultureInfo.InvariantCulture), OrderTif = FixCommon.Converter.ConvertTif.GetLocalValue(executionReport.TimeInForce.getValue()) }; return(order); }
new public void onMessage(QuickFix.FIX43.ExecutionReport message, SessionID sessionID) { }
/// <summary> /// /// </summary> /// <param name="executionReport">Execution report</param> /// <param name="sessionId">Session ID</param> private void OnMessage(QuickFix.FIX43.ExecutionReport executionReport, SessionID sessionId) { try { switch (executionReport.ExecType.getValue()) { case ExecType.NEW: { Order order = PopulateOder(executionReport); if (Logger.IsDebugEnabled) { Logger.Debug("New arrived : " + order, _type.FullName, "OnMessage"); } if (NewArrived != null) { NewArrived(order); } break; } case ExecType.CANCELED: { Order order = PopulateOder(executionReport); if (Logger.IsDebugEnabled) { Logger.Debug("Cancellation arrived : " + order, _type.FullName, "OnMessage"); } if (CancellationArrived != null) { CancellationArrived(order); } break; } case ExecType.REJECTED: var rejection = ExtractOrderRejection(executionReport); if (OrderRejectionArrived != null) { OrderRejectionArrived(rejection); } break; case ExecType.TRADE: { Execution execution = PopulateExecution(executionReport); if (Logger.IsDebugEnabled) { Logger.Debug("Trade arrived : " + execution, _type.FullName, "OnMessage"); } if (ExecutionArrived != null) { ExecutionArrived(execution); } break; } } } catch (Exception exception) { Logger.Error(exception.ToString(), _type.FullName, "OnMessage"); } }