private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission) { SmartQuant.FIX.ExecutionReport executionReport = new SmartQuant.FIX.ExecutionReport(); executionReport.TransactTime = Clock.Now; executionReport.ClOrdID = record.Order.ClOrdID; executionReport.OrigClOrdID = record.Order.ClOrdID; executionReport.OrderID = record.Order.OrderID; executionReport.Symbol = record.Order.Symbol; executionReport.SecurityType = record.Order.SecurityType; executionReport.SecurityExchange = record.Order.SecurityExchange; executionReport.Currency = record.Order.Currency; executionReport.CommType = commType; executionReport.Commission = commission; executionReport.Side = record.Order.Side; if (ordStatus == OrdStatus.Replaced) { executionReport.OrdType = (record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : record.Order.OrdType); executionReport.TimeInForce = (record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : record.Order.TimeInForce); executionReport.OrderQty = (record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : record.Order.OrderQty); executionReport.Price = (record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : record.Order.Price); executionReport.StopPx = (record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : record.Order.StopPx); record.LeavesQty = (int)executionReport.OrderQty - record.CumQty; } else { executionReport.OrdType = record.Order.OrdType; executionReport.TimeInForce = record.Order.TimeInForce; executionReport.OrderQty = record.Order.OrderQty; executionReport.Price = record.Order.Price; executionReport.StopPx = record.Order.StopPx; } executionReport.LastPx = lastPx; executionReport.LastQty = (double)lastQty; if (ordStatus == OrdStatus.Undefined) { record.AddFill(lastPx, lastQty); if (record.LeavesQty > 0) { ordStatus = OrdStatus.PartiallyFilled; } else { ordStatus = OrdStatus.Filled; } } executionReport.AvgPx = record.AvgPx; executionReport.CumQty = (double)record.CumQty; executionReport.LeavesQty = (double)record.LeavesQty; executionReport.ExecType = this.GetExecType(ordStatus); executionReport.OrdStatus = ordStatus; executionReport.Text = text; this.EmitExecutionReport(executionReport); }
private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text) { this.EmitOrderCancelReject(new OrderCancelReject { TransactTime = Clock.Now, ClOrdID = record.Order.ClOrdID, OrigClOrdID = record.Order.ClOrdID, OrdStatus = ordStatus, CxlRejResponseTo = responseTo, CxlRejReason = CxlRejReason.BrokerOption, Text = text }); }
private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text) { OrderCancelReject reject = new OrderCancelReject(); reject.TransactTime = Clock.Now; reject.ClOrdID = ((FIXNewOrderSingle)record.Order).ClOrdID; reject.OrigClOrdID = ((FIXNewOrderSingle)record.Order).ClOrdID; reject.OrdStatus = ordStatus; reject.CxlRejResponseTo = responseTo; reject.CxlRejReason = CxlRejReason.BrokerOption; reject.Text = text; this.EmitOrderCancelReject(reject); }
private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission) { FreeQuant.FIX.ExecutionReport report = new FreeQuant.FIX.ExecutionReport(); report.TransactTime = Clock.Now; report.ClOrdID = ((FIXNewOrderSingle)record.Order).ClOrdID; report.OrigClOrdID = ((FIXNewOrderSingle)record.Order).ClOrdID; report.OrderID = record.Order.OrderID; report.Symbol = ((FIXNewOrderSingle)record.Order).Symbol; report.SecurityType = ((FIXNewOrderSingle)record.Order).SecurityType; report.SecurityExchange = ((FIXNewOrderSingle)record.Order).SecurityExchange; report.Currency = ((FIXNewOrderSingle)record.Order).Currency; report.CommType = commType; report.Commission = commission; report.Side = ((NewOrderSingle)record.Order).Side; if (ordStatus == OrdStatus.Replaced) { report.OrdType = record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : ((NewOrderSingle)record.Order).OrdType; report.TimeInForce = record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : ((NewOrderSingle)record.Order).TimeInForce; report.OrderQty = record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : ((FIXNewOrderSingle)record.Order).OrderQty; report.Price = record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : ((FIXNewOrderSingle)record.Order).Price; report.StopPx = record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : ((FIXNewOrderSingle)record.Order).StopPx; record.LeavesQty = (int)report.OrderQty - record.CumQty; } else { report.OrdType = ((NewOrderSingle)record.Order).OrdType; report.TimeInForce = ((NewOrderSingle)record.Order).TimeInForce; report.OrderQty = ((FIXNewOrderSingle)record.Order).OrderQty; report.Price = ((FIXNewOrderSingle)record.Order).Price; report.StopPx = ((FIXNewOrderSingle)record.Order).StopPx; } report.LastPx = lastPx; report.LastQty = (double)lastQty; if (ordStatus == OrdStatus.Undefined) { record.AddFill(lastPx, lastQty); ordStatus = record.LeavesQty <= 0 ? OrdStatus.Filled : OrdStatus.PartiallyFilled; } report.AvgPx = record.AvgPx; report.CumQty = (double)record.CumQty; report.LeavesQty = (double)record.LeavesQty; report.ExecType = this.GetExecType(ordStatus); report.OrdStatus = ordStatus; report.Text = text; this.EmitExecutionReport(report); }
private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text) { this.EmitExecutionReport(record, ordStatus, lastPx, lastQty, text, CommType.Absolute, 0.0); }
public void EmitCancelReplaceReject(Order order, OrdStatus status, string message) { OrderRecord record = this.orderRecords[order]; this.EmitOrderCancelReject(record, status, CxlRejResponseTo.CancelReplaceRequest, message); }
public void EmitExecutionReport(Order order, OrdStatus status, string text) { OrderRecord record = this.orderRecords[order]; this.EmitExecutionReport(record, status, 0.0, 0, text); }
public void EmitExecutionReport(Order order, double price, int quantity, CommType commType, double commission) { OrderRecord record = this.orderRecords[order]; this.EmitExecutionReport(record, OrdStatus.Undefined, price, quantity, "", commType, commission); }
private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text) { OrderCancelReject reject = new OrderCancelReject(); reject.TransactTime = Clock.Now; reject.ClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID; reject.OrigClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID; reject.OrdStatus = ordStatus; reject.CxlRejResponseTo = responseTo; reject.CxlRejReason = CxlRejReason.BrokerOption; reject.Text = text; this.EmitOrderCancelReject(reject); }
private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission) { FreeQuant.FIX.ExecutionReport report = new FreeQuant.FIX.ExecutionReport(); report.TransactTime = Clock.Now; report.ClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID; report.OrigClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID; report.OrderID = record.Order.OrderID; report.Symbol = ((FIXNewOrderSingle) record.Order).Symbol; report.SecurityType = ((FIXNewOrderSingle) record.Order).SecurityType; report.SecurityExchange = ((FIXNewOrderSingle) record.Order).SecurityExchange; report.Currency = ((FIXNewOrderSingle) record.Order).Currency; report.CommType = commType; report.Commission = commission; report.Side = ((NewOrderSingle) record.Order).Side; if (ordStatus == OrdStatus.Replaced) { report.OrdType = record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : ((NewOrderSingle) record.Order).OrdType; report.TimeInForce = record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : ((NewOrderSingle) record.Order).TimeInForce; report.OrderQty = record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : ((FIXNewOrderSingle) record.Order).OrderQty; report.Price = record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : ((FIXNewOrderSingle) record.Order).Price; report.StopPx = record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : ((FIXNewOrderSingle) record.Order).StopPx; record.LeavesQty = (int) report.OrderQty - record.CumQty; } else { report.OrdType = ((NewOrderSingle) record.Order).OrdType; report.TimeInForce = ((NewOrderSingle) record.Order).TimeInForce; report.OrderQty = ((FIXNewOrderSingle) record.Order).OrderQty; report.Price = ((FIXNewOrderSingle) record.Order).Price; report.StopPx = ((FIXNewOrderSingle) record.Order).StopPx; } report.LastPx = lastPx; report.LastQty = (double) lastQty; if (ordStatus == OrdStatus.Undefined) { record.AddFill(lastPx, lastQty); ordStatus = record.LeavesQty <= 0 ? OrdStatus.Filled : OrdStatus.PartiallyFilled; } report.AvgPx = record.AvgPx; report.CumQty = (double) record.CumQty; report.LeavesQty = (double) record.LeavesQty; report.ExecType = this.GetExecType(ordStatus); report.OrdStatus = ordStatus; report.Text = text; this.EmitExecutionReport(report); }