Exemple #1
0
        private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text)
        {
            ExecutionReport report = new ExecutionReport
            {
                TransactTime     = Clock.Now,
                ClOrdID          = record.Order.ClOrdID,
                OrigClOrdID      = record.Order.ClOrdID,
                OrderID          = record.Order.OrderID,
                Symbol           = record.Order.Symbol,
                SecurityType     = record.Order.SecurityType,
                SecurityExchange = record.Order.SecurityExchange,
                Currency         = record.Order.Currency,
                Side             = record.Order.Side,
                OrdType          = record.Order.OrdType,
                TimeInForce      = record.Order.TimeInForce,
                OrderQty         = record.Order.OrderQty,
                Price            = record.Order.Price,
                StopPx           = record.Order.StopPx,
                LastPx           = lastPx,
                LastQty          = lastQty
            };

            if (ordStatus == OrdStatus.Undefined)
            {
                record.AddFill(lastPx, lastQty);
                if (record.LeavesQty > 0)
                {
                    ordStatus = OrdStatus.PartiallyFilled;
                }
                else
                {
                    ordStatus = OrdStatus.Filled;
                }
            }
            report.AvgPx     = record.AvgPx;
            report.CumQty    = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.ExecType  = CTPProvider.GetExecType(ordStatus);
            report.OrdStatus = ordStatus;
            report.Text      = text;

            EmitExecutionReport(report);
        }
        private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text)
        {
            ExecutionReport report = new ExecutionReport
            {
                TransactTime = Clock.Now,
                ClOrdID = record.Order.ClOrdID,
                OrigClOrdID = record.Order.ClOrdID,
                OrderID = record.Order.OrderID,
                Symbol = record.Order.Symbol,
                SecurityType = record.Order.SecurityType,
                SecurityExchange = record.Order.SecurityExchange,
                Currency = record.Order.Currency,
                Side = record.Order.Side,
                OrdType = record.Order.OrdType,
                TimeInForce = record.Order.TimeInForce,
                OrderQty = record.Order.OrderQty,
                Price = record.Order.Price,
                StopPx = record.Order.StopPx,
                LastPx = lastPx,
                LastQty = lastQty
            };
            if (ordStatus == OrdStatus.Undefined)
            {
                record.AddFill(lastPx, lastQty);
                if (record.LeavesQty > 0)
                {
                    ordStatus = OrdStatus.PartiallyFilled;
                }
                else
                {
                    ordStatus = OrdStatus.Filled;
                }
            }
            report.AvgPx = record.AvgPx;
            report.CumQty = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.ExecType = this.GetExecType(ordStatus);
            report.OrdStatus = ordStatus;
            report.Text = text;

            EmitExecutionReport(report);
        }
        private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission)
        {
            ExecutionReport report = new ExecutionReport
            {
                TransactTime = Clock.Now,
                ClOrdID = record.Order.ClOrdID,
                OrigClOrdID = record.Order.ClOrdID,
                OrderID = record.Order.OrderID,
                Symbol = record.Order.Symbol,
                SecurityType = record.Order.SecurityType,
                SecurityExchange = record.Order.SecurityExchange,
                Currency = record.Order.Currency,
                CommType = commType,
                Commission = commission,
                Side = record.Order.Side,

                OrdType = record.Order.OrdType,
                TimeInForce = record.Order.TimeInForce,
                OrderQty = record.Order.OrderQty,
                Price = record.Order.Price,
                StopPx = record.Order.StopPx,
                LastPx = lastPx,
                LastQty = lastQty
            };

            if (ordStatus == OrdStatus.Replaced)
            {
                report.OrdType = record.Order.ReplaceOrder.ContainsField(EFIXField.OrdType) ? record.Order.ReplaceOrder.OrdType : record.Order.OrdType;
                report.TimeInForce = record.Order.ReplaceOrder.ContainsField(EFIXField.TimeInForce) ? record.Order.ReplaceOrder.TimeInForce : record.Order.TimeInForce;
                report.OrderQty = record.Order.ReplaceOrder.ContainsField(EFIXField.OrderQty) ? record.Order.ReplaceOrder.OrderQty : record.Order.OrderQty;
                report.Price = record.Order.ReplaceOrder.ContainsField(EFIXField.Price) ? record.Order.ReplaceOrder.Price : record.Order.Price;
                report.StopPx = record.Order.ReplaceOrder.ContainsField(EFIXField.StopPx) ? record.Order.ReplaceOrder.StopPx : record.Order.StopPx;
                record.LeavesQty = ((int)report.OrderQty) - record.CumQty;
            }
            else
            {
                report.OrdType = record.Order.OrdType;
                report.TimeInForce = record.Order.TimeInForce;
                report.OrderQty = record.Order.OrderQty;
                report.Price = record.Order.Price;
                report.StopPx = record.Order.StopPx;
            }


            if (ordStatus == OrdStatus.Undefined)
            {
                record.AddFill(lastPx, lastQty);
                if (record.LeavesQty > 0)
                {
                    ordStatus = OrdStatus.PartiallyFilled;
                }
                else
                {
                    ordStatus = OrdStatus.Filled;
                }
            }
            report.AvgPx = record.AvgPx;
            report.CumQty = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.ExecType = GetExecType(ordStatus);
            report.OrdStatus = ordStatus;
            report.Text = text;

            EmitExecutionReport(report);
        }
Exemple #4
0
        public void EmitExecutionReport(SingleOrder order, double price, int quantity)
        {
            OrderRecord record = orderRecords[order];

            EmitExecutionReport(record, OrdStatus.Undefined, price, quantity, "");
        }
Exemple #5
0
        public void EmitExecutionReport(SingleOrder order, OrdStatus status, string text)
        {
            OrderRecord record = orderRecords[order];

            EmitExecutionReport(record, status, 0.0, 0, text);
        }