Beispiel #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);
        }
 public void Init(CTPProvider provider)
 {
     this.provider = provider;
 }
 public void Init(CTPProvider provider)
 {
     this.provider = provider;
 }