示例#1
0
 public override void onMessage(QuickFix42.ExecutionReport report, SessionID sessionID)
 {
     if (ExecutionReport != null)
     {
         ExecutionReport(sessionID, new ExecutionReportEventArgs(report));
     }
 }
示例#2
0
        //35 = D
        public override void onMessage(QuickFix42.NewOrderSingle message, SessionID sessionID)
        {
            Console.WriteLine("Receive message " + message.getHeader().getField(35) + ", session: " + sessionID.toString());
            try
            {
                ClOrdID      clordid = message.getClOrdID();
                string       clord   = clordid.getValue();
                Side         side    = message.getSide();
                char         s       = side.getValue();
                OrdType      ordtype = message.getOrdType();
                char         ord     = ordtype.getValue();
                TransactTime time    = message.getTransactTime();
                DateTime     dt      = time.getValue();

                QuickFix42.ExecutionReport executionReport = new QuickFix42.ExecutionReport(new OrderID("neworderid"), new ExecID("Hehe")
                                                                                            , new ExecTransType(ExecTransType.CORRECT), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.DONE_FOR_DAY),
                                                                                            new Symbol("VND"), new Side(Side.BUY), new LeavesQty(1), new CumQty(2), new AvgPx(100));

                bool x = Session.sendToTarget(executionReport, sessionID);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
示例#3
0
        public void ParseFixLog(string fixLogPath)
        {
            if (!File.Exists(fixLogPath))
            {
                Console.WriteLine("File does not Exist");
                return;
            }

            TextReader tr = new StreamReader(fixLogPath);

            string currentMessage = tr.ReadLine();
            int    count          = 0;

            while (currentMessage != null)
            {
                if (/*msgIsToday(currentMessage) &&*/ _MsgIsOfInterest(currentMessage))
                {
                    QuickFix42.ExecutionReport fixMsg = _GetMessageTypeObject(currentMessage);

                    if (fixMsg == null)
                    {
                        continue;
                    }

                    fixMsg.setField(57, "7857955");
                    fixMsg.setField(76, "RANE");

                    //break message into pieces
                    string[] msgFields = currentMessage.Split(ct_fixElementDelimeter);
                    //loadPieces
                    foreach (string field in msgFields)
                    {
                        string[] elements = field.Split('=');
                        if (elements.Count() < 2 || elements[0].Equals("10") || elements[0].Equals("8") || elements[0].Equals("9") ||
                            elements[0].Equals("35") || elements[0].Equals("34"))    /* || elements[0].Equals("49") || elements[0].Equals("52")
                                                                                     || elements[0].Equals("56"))*/
                        {
                            continue;
                        }

                        if (elements[0].Equals("1"))
                        {
                            fixMsg.setField(1, "54321");
                        }
                        else
                        {
                            fixMsg.setField(int.Parse(elements[0]), elements[1]);
                        }
                    }
                    _AddToDictionary(fixMsg);
                }

                currentMessage = tr.ReadLine();
                count++;
            }

            Console.WriteLine("Loading log complete...");
            //passtoLogger();
        }
示例#4
0
        public override void onMessage(QuickFix42.ExecutionReport message, QuickFix.SessionID session)
        {
            parseMessage(message, session);

            _TTOrderKey = message.getOrderID().ToString();
            updateDisplay(string.Format("Current TT Order key is: {0}", _TTOrderKey));

            updateFormData();
        }
示例#5
0
        public override void onMessage(QuickFix42.NewOrderSingle order, SessionID sessionID)
        {
            Symbol   symbol   = new Symbol();
            Side     side     = new Side();
            OrdType  ordType  = new OrdType();
            OrderQty orderQty = new OrderQty();
            Price    price    = new Price();
            ClOrdID  clOrdID  = new ClOrdID();

            order.get(ordType);

            if (ordType.getValue() != OrdType.LIMIT)
            {
                throw new IncorrectTagValue(ordType.getField());
            }

            order.get(symbol);
            order.get(side);
            order.get(orderQty);
            order.get(price);
            order.get(clOrdID);

            QuickFix42.ExecutionReport executionReport = new QuickFix42.ExecutionReport
                                                             (genOrderID(),
                                                             genExecID(),
                                                             new ExecTransType(ExecTransType.NEW),
                                                             new ExecType(ExecType.FILL),
                                                             new OrdStatus(OrdStatus.FILLED),
                                                             symbol,
                                                             side,
                                                             new LeavesQty(0),
                                                             new CumQty(orderQty.getValue()),
                                                             new AvgPx(price.getValue()));

            executionReport.set(clOrdID);
            executionReport.set(orderQty);
            executionReport.set(new LastShares(orderQty.getValue()));
            executionReport.set(new LastPx(price.getValue()));

            if (order.isSetAccount())
            {
                executionReport.set(order.getAccount());
            }

            try
            {
                Session.sendToTarget(executionReport, sessionID);
            }
            catch (SessionNotFound) {}
        }
        // MESSAGECRACKER BASE CLASS FUNCTIONS
        #region MESSAGECRACKER INHERITED FUNCTIONS

        //need new order single
        //Order cancel request
        //order cancel replace reject
        //session level reject 35=3

        // Upon receipt of an executed trade message
        public override void onMessage(QuickFix42.ExecutionReport message, SessionID sessionId)
        {
            //            MessageBox.Show("ExecutionReport: " + message.ToString());
            string theMessage = message.ToString();

            //Console.WriteLine("Execution Received: "+ theMessage);

            if (!message.isSetField(35) && !message.getHeader().isSetField(35))
            {
                message.setField(35, "8");
            }

            DbHandle.Instance.InsertMessageCommand("MlDropCopy", new GatFixMessage(message, "MlDropCopy", _executionFieldMap));
        }
        private void addToDictionary(QuickFix42.ExecutionReport msg)
        {
            ClOrdID clID = new ClOrdID();

            msg.getField(clID);
            string ID = clID.getValue();

            if (TodaysMessages.ContainsKey(ID))
            {
                TodaysMessages[ID].Add(msg);
            }
            else
            {
                List <QuickFix42.ExecutionReport> list = new List <QuickFix42.ExecutionReport>();
                list.Add(msg);
                TodaysMessages.Add(ID, list);
            }
        }
示例#8
0
        private static void _AddToDictionary(QuickFix42.ExecutionReport msg)
        {
            ClOrdID clId = new ClOrdID();

            msg.getField(clId);
            string id = clId.getValue();

            if (TodaysMessages.ContainsKey(id))
            {
                TodaysMessages[id].Add(msg);
            }
            else
            {
                List <QuickFix42.ExecutionReport> list = new List <QuickFix42.ExecutionReport> {
                    msg
                };
                TodaysMessages.Add(id, list);
            }
        }
示例#9
0
        //35=8
        public override void onMessage(QuickFix42.ExecutionReport message, SessionID session)
        {
            ExecType et   = message.getExecType();
            char     type = et.getValue();

            switch (type)
            {
            case 'A':
                OrdStatus ordS   = message.getOrdStatus();
                char      status = ordS.getValue();
                //if status == 'A'
                //order acknowledgement
                break;

            case '0':
            case 'B':
            case 'F':
                break;
            }
        }
示例#10
0
        // MESSAGECRACKER BASE CLASS FUNCTIONS
        #region MESSAGECRACKER INHERITED FUNCTIONS

        //need new order single
        //Order cancel request
        //order cancel replace reject
        //session level reject 35=3

        // Upon receipt of an executed trade message
        public override void onMessage(QuickFix42.ExecutionReport message, SessionID sessionID)
        {
            //oOrderManager.ProcessExecution(message, sessionID); // passing the work to the order manager
            //            MessageBox.Show("ExecutionReport: " + message.ToString());
            string theMessage = message.ToString();

            Console.WriteLine("Execution Received: " + theMessage);

            //ConsoleKeyInfo keyInfo;
            //if(!once)
            //     keyInfo = Console.ReadKey();

            //once = true;

            //orderCount++;
            //tw.WriteLine(orderCount + " *__* " + message.ToString());

            OrderID orderID = new OrderID();

            message.getField(orderID);
            Program.ExecutionOrderID = orderID.getValue();
        }
示例#11
0
        public void OnExecutionReport(object sender, ExecutionReportEventArgs e)
        {
            if (ExecutionReport != null)
            {
                QuickFix42.ExecutionReport sourceReport = e.ExecutionReport;
                try
                {
                    SmartQuant.FIX.ExecutionReport report = new SmartQuant.FIX.ExecutionReport();
                    if (sourceReport.isSetField(41))//如果已有原始编号OrigClOrdID
                    {
                        report.OrigClOrdID = sourceReport.getOrigClOrdID().getValue();
                    }
                    else if (sourceReport.isSetField(11))//如果有标识委托所对应的ClOrdID
                    {
                        report.ClOrdID = sourceReport.getClOrdID().getValue();
                    }

                    report.ExecID = sourceReport.getExecID().getValue();
                    char execType = sourceReport.getExecType().getValue();
                    //Console.WriteLine(execType);
                    switch (execType)//订单执行结果
                    {
                    case '0':
                        report.ExecType = ExecType.New;
                        break;

                    case '1':
                        report.ExecType = ExecType.PartialFill;
                        break;

                    case '2':
                        report.ExecType = ExecType.Fill;
                        break;

                    case '4':
                        report.ExecType = ExecType.Cancelled;
                        break;

                    case '6':
                        report.ExecType = ExecType.PendingCancel;
                        break;

                    case '8':
                        report.ExecType = ExecType.Rejected;
                        break;

                    default:
                        report.ExecType = ExecType.Undefined;
                        break;
                    }
                    if ((execType == '1') || (execType == '2'))                   //执行结果是部分成交或是全部成交
                    {
                        report.LastPx  = sourceReport.getLastPx().getValue();     //本次成交均价
                        report.LastQty = sourceReport.getLastShares().getValue(); //本次成交数量
                    }
                    report.OrderQty = sourceReport.getOrderQty().getValue();      //订单委托量

                    char orderStatus = sourceReport.getOrdStatus().getValue();
                    if (orderStatus == '1' || orderStatus == '2')               //订单状态是部分成交或是全部成交
                    {
                        report.AvgPx     = sourceReport.getAvgPx().getValue();  //平均成交价
                        report.CumQty    = sourceReport.getCumQty().getValue(); //累计成交量
                        report.LeavesQty = report.OrderQty - report.CumQty;     //未成交量
                    }

                    switch (orderStatus)
                    {
                    case '0':
                        report.OrdStatus = OrdStatus.New;
                        break;

                    case '1':
                        report.OrdStatus = OrdStatus.PartiallyFilled;
                        break;

                    case '2':
                        report.OrdStatus = OrdStatus.Filled;
                        break;

                    case '4':
                        report.OrdStatus = OrdStatus.Cancelled;
                        break;

                    case '6':
                        report.OrdStatus = OrdStatus.PendingCancel;
                        break;

                    case '8':
                        report.OrdStatus = OrdStatus.Rejected;
                        break;

                    default:
                        report.OrdStatus = OrdStatus.Undefined;
                        break;
                    }
                    if (sourceReport.isSetTransactTime())//传送时间
                    {
                        report.TransactTime = sourceReport.getTransactTime().getValue();
                    }
                    if (sourceReport.isSetText())
                    {
                        report.Text = sourceReport.getText().getValue();
                    }
                    ExecutionReport(this, new SmartQuant.FIX.ExecutionReportEventArgs(report));
                }
                catch (Exception ex)
                {
                    EmitError(-1, -1, ex.Message);
                }
            }
        }
示例#12
0
 // Methods
 public ExecutionReportEventArgs(QuickFix42.ExecutionReport report)
 {
     this.report = report;
 }
示例#13
0
		public virtual void Send(FIXExecutionReport Report)
		{
			QuickFix.FIX42.ExecutionReport executionReport = new QuickFix42.ExecutionReport(new OrderID(Report.OrderID), new ExecID(Report.ExecID), new QuickFix.ExecTransType('0'), new QuickFix.ExecType(Report.ExecType), new QuickFix.OrdStatus(Report.OrdStatus), new Symbol(Report.Symbol), new QuickFix.Side(Report.Side), new LeavesQty(Report.LeavesQty), new CumQty(Report.CumQty), new AvgPx(Report.AvgPx));
			if (Report.ContainsField(198))
				executionReport.set(new SecondaryOrderID(Report.SecondaryOrderID));
			if (Report.ContainsField(11))
				executionReport.set(new ClOrdID(Report.ClOrdID));
			if (Report.ContainsField(41))
				executionReport.set(new OrigClOrdID(Report.OrigClOrdID));
			if (Report.ContainsField(66))
				executionReport.set(new ListID(Report.ListID));
			if (Report.ContainsField(19))
				executionReport.set(new ExecRefID(Report.ExecRefID));
			if (Report.ContainsField(103))
				executionReport.set(new OrdRejReason(Report.OrdRejReason));
			if (Report.ContainsField(378))
				executionReport.set(new ExecRestatementReason(Report.ExecRestatementReason));
			if (Report.ContainsField(1))
				executionReport.set(new Account(Report.Account));
			if (Report.ContainsField(65))
				executionReport.set(new SymbolSfx(Report.SymbolSfx));
			if (Report.ContainsField(48))
				executionReport.set(new SecurityID(Report.SecurityID));
			if (Report.ContainsField(167))
				executionReport.set(new QuickFix.SecurityType(Report.SecurityType));
			if (Report.ContainsField(200))
				executionReport.set(new MaturityMonthYear(Report.MaturityMonthYear));
			if (Report.ContainsField(202))
				executionReport.set(new StrikePrice(Report.StrikePrice));
			if (Report.ContainsField(206))
				executionReport.set(new OptAttribute(Report.OptAttribute));
			if (Report.ContainsField(231))
				executionReport.set(new ContractMultiplier(Report.ContractMultiplier));
			if (Report.ContainsField(223))
				executionReport.set(new CouponRate(Report.CouponRate));
			if (Report.ContainsField(207))
				executionReport.set(new SecurityExchange(Report.SecurityExchange));
			if (Report.ContainsField(106))
				executionReport.set(new Issuer(Report.Issuer));
			if (Report.ContainsField(348))
				executionReport.set(new EncodedIssuerLen(Report.EncodedIssuerLen));
			if (Report.ContainsField(349))
				executionReport.set(new EncodedIssuer(Report.EncodedIssuer));
			if (Report.ContainsField(107))
				executionReport.set(new SecurityDesc(Report.SecurityDesc));
			if (Report.ContainsField(350))
				executionReport.set(new EncodedSecurityDescLen(Report.EncodedSecurityDescLen));
			if (Report.ContainsField(351))
				executionReport.set(new EncodedSecurityDesc(Report.EncodedSecurityDesc));
			if (Report.ContainsField(38))
				executionReport.set(new OrderQty(Report.OrderQty));
			if (Report.ContainsField(152))
				executionReport.set(new CashOrderQty(Report.CashOrderQty));
			if (Report.ContainsField(40))
				executionReport.set(new QuickFix.OrdType(Report.OrdType));
			if (Report.ContainsField(44))
				executionReport.set(new Price(Report.Price));
			if (Report.ContainsField(99))
				executionReport.set(new StopPx(Report.StopPx));
			if (Report.ContainsField(388))
				executionReport.set(new DiscretionInst(Report.DiscretionInst));
			if (Report.ContainsField(15))
				executionReport.set(new QuickFix.Currency(Report.Currency));
			if (Report.ContainsField(376))
				executionReport.set(new ComplianceID(Report.ComplianceID));
			if (Report.ContainsField(59))
				executionReport.set(new QuickFix.TimeInForce(Report.TimeInForce));
			if (Report.ContainsField(168))
				executionReport.set(new EffectiveTime(Report.EffectiveTime));
			if (Report.ContainsField(126))
				executionReport.set(new ExpireTime(Report.ExpireTime));
			if (Report.ContainsField(18))
				executionReport.set(new ExecInst(Report.ExecInst));
			if (Report.ContainsField(31))
				executionReport.set(new LastPx(Report.LastPx));
			if (Report.ContainsField(194))
				executionReport.set(new LastSpotRate(Report.LastSpotRate));
			if (Report.ContainsField(195))
				executionReport.set(new LastForwardPoints(Report.LastForwardPoints));
			if (Report.ContainsField(30))
				executionReport.set(new LastMkt(Report.LastMkt));
			if (Report.ContainsField(336))
				executionReport.set(new TradingSessionID(Report.TradingSessionID));
			if (Report.ContainsField(29))
				executionReport.set(new LastCapacity(Report.LastCapacity));
			if (Report.ContainsField(424))
				executionReport.set(new DayOrderQty(Report.DayOrderQty));
			if (Report.ContainsField(425))
				executionReport.set(new DayCumQty(Report.DayCumQty));
			if (Report.ContainsField(426))
				executionReport.set(new DayAvgPx(Report.DayAvgPx));
			if (Report.ContainsField(427))
				executionReport.set(new GTBookingInst(Report.GTBookingInst));
			if (Report.ContainsField(60))
				executionReport.set(new TransactTime(Report.TransactTime));
			if (Report.ContainsField(13))
				executionReport.set(new QuickFix.CommType(Report.CommType));
			if (Report.ContainsField(381))
				executionReport.set(new GrossTradeAmt(Report.GrossTradeAmt));
			if (Report.ContainsField(119))
				executionReport.set(new SettlCurrAmt(Report.SettlCurrAmt));
			if (Report.ContainsField(120))
				executionReport.set(new SettlCurrency(Report.SettlCurrency));
			if (Report.ContainsField(21))
				executionReport.set(new HandlInst(Report.HandlInst));
			if (Report.ContainsField(110))
				executionReport.set(new MinQty(Report.MinQty));
			if (Report.ContainsField(111))
				executionReport.set(new MaxFloor(Report.MaxFloor));
			if (Report.ContainsField(210))
				executionReport.set(new MaxShow(Report.MaxShow));
			if (Report.ContainsField(58))
				executionReport.set(new Text(Report.Text));
			if (Report.ContainsField(354))
				executionReport.set(new EncodedTextLen(Report.EncodedTextLen));
			if (Report.ContainsField(355))
				executionReport.set(new EncodedText(Report.EncodedText));
			if (Report.ContainsField(192))
				executionReport.set(new OrderQty2(Report.OrderQty2));
			if (Report.ContainsField(442))
				executionReport.set(new MultiLegReportingType(Report.MultiLegReportingType));
			try
			{
				Session.sendToTarget((QuickFix.Message)executionReport, this.fSessionID);
			}
			catch (Exception ex)
			{
				Console.WriteLine(BeAEwTZGlZaeOmY5cm.J00weU3cM6(1304) + ex.Message);
			}
		}
        public override void onMessage(QuickFix42.ExecutionReport report, QuickFix.SessionID sessionID)
        {
            if (report.getExecType().getValue() == QuickFix.ExecType.PENDING_CANCEL ||
                report.getExecType().getValue() == QuickFix.ExecType.CANCELED ||
                report.getExecType().getValue() == QuickFix.ExecType.PENDING_REPLACE ||
                report.getExecType().getValue() == QuickFix.ExecType.REPLACE)
            {
                object request = cancelRequests[report.getClOrdID().getValue()];

                if (request == null)
                {
                    report.set(new OrigClOrdID(report.getClOrdID().getValue()));
                }
                else
                {
                    if (request is FIXOrderCancelRequest)
                    {
                        report.set(new OrigClOrdID((request as FIXOrderCancelRequest).OrigClOrdID));
                    }

                    if (request is FIXOrderCancelReplaceRequest)
                    {
                        report.set(new OrigClOrdID((request as FIXOrderCancelReplaceRequest).OrigClOrdID));
                    }
                }
            }

            ExecutionReport Report = new ExecutionReport();

            if (report.isSetOrderID())
            {
                Report.OrderID = report.getOrderID().getValue();
            }
            ////if (report.isSetSecondaryOrderID()) Report.SecondaryOrderID = report.getSecondaryOrderID().getValue();
            if (report.isSetClOrdID())
            {
                Report.ClOrdID = report.getClOrdID().getValue();
            }
            if (report.isSetOrigClOrdID())
            {
                Report.OrigClOrdID = report.getOrigClOrdID().getValue();
            }
            ////if (report.isSetListID()) Report.ListID = report.getListID().getValue();
            if (report.isSetExecID())
            {
                Report.ExecID = report.getExecID().getValue();
            }
            ////if (report.isSetExecRefID()) Report.ExecRefID = report.getExecRefID().getValue();
            if (report.isSetExecType())
            {
                (Report as FIXExecutionReport).ExecType = report.getExecType().getValue();
            }
            if (report.isSetOrdStatus())
            {
                (Report as FIXExecutionReport).OrdStatus = report.getOrdStatus().getValue();
            }
            if (report.isSetOrdRejReason())
            {
                Report.OrdRejReason = report.getOrdRejReason().getValue();
            }
            ////if (report.isSetExecRestatementReason()) Report.ExecRestatementReason = report.getExecRestatementReason().getValue();
            ////if (report.isSetAccount()) Report.Account = report.getAccount().getValue();
            ////if (report.isSetSettlmntTyp()) Report.SettlType = report.getSettlmntTyp().getValue();
            //if (report.isSetFutSettDate           ()) Report.FutSettDate            = report.getFutSettDate           ().getValue();
            if (report.isSetSymbol())
            {
                Report.Symbol = report.getSymbol().getValue();
            }
            ////if (report.isSetSymbolSfx()) Report.SymbolSfx = report.getSymbolSfx().getValue();
            ////if (report.isSetSecurityID()) Report.SecurityID = report.getSecurityID().getValue();
            //if (report.isSetIDSource              ()) Report.IDSource               = report.getIDSource              ().getValue();
            ////if (report.isSetSecurityType()) Report.SecurityType = report.getSecurityType().getValue();
            ////if (report.isSetMaturityMonthYear()) Report.MaturityMonthYear = report.getMaturityMonthYear().getValue();
            //if (report.isSetMaturityDay           ()) Report.MaturityDate           = DateTime.Parse(report.getMaturityDay           ().getValue());
            //if (report.isSetPutOrCall             ()) Report.PutOrCall              = report.getPutOrCall             ().getValue();
            ////if (report.isSetStrikePrice()) Report.StrikePrice = report.getStrikePrice().getValue();
            ////if (report.isSetOptAttribute()) Report.OptAttribute = report.getOptAttribute().getValue();
            ////if (report.isSetContractMultiplier()) Report.ContractMultiplier = report.getContractMultiplier().getValue();
            ////if (report.isSetCouponRate()) Report.CouponRate = report.getCouponRate().getValue();
            ////if (report.isSetSecurityExchange()) Report.SecurityExchange = report.getSecurityExchange().getValue();
            ////if (report.isSetIssuer()) Report.Issuer = report.getIssuer().getValue();
            ////if (report.isSetEncodedIssuerLen()) Report.EncodedIssuerLen = report.getEncodedIssuerLen().getValue();
            ////if (report.isSetEncodedIssuer()) Report.EncodedIssuer = report.getEncodedIssuer().getValue();
            ////if (report.isSetSecurityDesc()) Report.SecurityDesc = report.getSecurityDesc().getValue();
            ////if (report.isSetEncodedSecurityDescLen()) Report.EncodedSecurityDescLen = report.getEncodedSecurityDescLen().getValue();
            ////if (report.isSetEncodedSecurityDesc()) Report.EncodedSecurityDesc = report.getEncodedSecurityDesc().getValue();
            if (report.isSetSide())
            {
                (Report as FIXExecutionReport).Side = report.getSide().getValue();
            }
            if (report.isSetOrderQty())
            {
                Report.OrderQty = report.getOrderQty().getValue();
            }
            ////if (report.isSetCashOrderQty()) Report.CashOrderQty = report.getCashOrderQty().getValue();
            if (report.isSetOrdType())
            {
                (Report as FIXExecutionReport).OrdType = report.getOrdType().getValue();
            }
            if (report.isSetPrice())
            {
                Report.Price = report.getPrice().getValue();
            }
            ////if (report.isSetStopPx()) Report.StopPx = report.getStopPx().getValue();
            //if (report.isSetPegDifference         ()) Report.PegDifference          = report.getPegDifference         ().getValue();
            ////if (report.isSetDiscretionInst()) Report.DiscretionInst = report.getDiscretionInst().getValue();
            ////if (report.isSetDiscretionOffset()) Report.DiscretionOffsetValue = report.getDiscretionOffset().getValue();
            ////if (report.isSetCurrency()) Report.Currency = report.getCurrency().getValue();
            ////if (report.isSetComplianceID()) Report.ComplianceID = report.getComplianceID().getValue();
            //if (report.isSetSolicitedFlag         ()) Report.SolicitedFlag          = report.getSolicitedFlag         ().getValue();
            ////if (report.isSetTimeInForce()) (Report as FIXExecutionReport).TimeInForce = report.getTimeInForce().getValue();
            ////if (report.isSetEffectiveTime()) Report.EffectiveTime = report.getEffectiveTime().getValue();
            ////if (report.isSetExpireDate()) Report.ExpireDate = DateTime.Parse(report.getExpireDate().getValue());
            ////if (report.isSetExpireTime()) Report.ExpireTime = report.getExpireTime().getValue();
            ////if (report.isSetExecInst()) Report.ExecInst = report.getExecInst().getValue();
            //if (report.isSetRule80A               ()) Report.Rule80A                = report.getRule80A               ().getValue();
            if (report.isSetLastShares())
            {
                Report.LastQty = report.getLastShares().getValue();
            }
            if (report.isSetLastPx())
            {
                Report.LastPx = report.getLastPx().getValue();
            }
            ////if (report.isSetLastSpotRate()) Report.LastSpotRate = report.getLastSpotRate().getValue();
            ////if (report.isSetLastForwardPoints()) Report.LastForwardPoints = report.getLastForwardPoints().getValue();
            ////if (report.isSetLastMkt()) Report.LastMkt = report.getLastMkt().getValue();
            ////if (report.isSetTradingSessionID()) Report.TradingSessionID = report.getTradingSessionID().getValue();
            ////if (report.isSetLastCapacity()) Report.LastCapacity = report.getLastCapacity().getValue();
            if (report.isSetLeavesQty())
            {
                Report.LeavesQty = report.getLeavesQty().getValue();
            }
            if (report.isSetCumQty())
            {
                Report.CumQty = report.getCumQty().getValue();
            }
            if (report.isSetAvgPx())
            {
                Report.AvgPx = report.getAvgPx().getValue();
            }
            ////if (report.isSetDayOrderQty()) Report.DayOrderQty = report.getDayOrderQty().getValue();
            ////if (report.isSetDayCumQty()) Report.DayCumQty = report.getDayCumQty().getValue();
            ////if (report.isSetDayAvgPx()) Report.DayAvgPx = report.getDayAvgPx().getValue();
            ////if (report.isSetGTBookingInst()) Report.GTBookingInst = report.getGTBookingInst().getValue();
            ////if (report.isSetTradeDate()) Report.TradeDate = DateTime.Parse(report.getTradeDate().getValue());
            if (report.isSetTransactTime())
            {
                Report.TransactTime = report.getTransactTime().getValue();
            }
            //if (report.isSetReportToExch          ()) Report.ReportToExch           = report.getReportToExch          ().getValue();
            ////if (report.isSetCommission()) Report.Commission = report.getCommission().getValue();
            ////if (report.isSetCommType()) (Report as FIXExecutionReport).CommType = report.getCommType().getValue();
            ////if (report.isSetGrossTradeAmt()) Report.GrossTradeAmt = report.getGrossTradeAmt().getValue();
            ////if (report.isSetSettlCurrAmt()) Report.SettlCurrAmt = report.getSettlCurrAmt().getValue();
            ////if (report.isSetSettlCurrency()) Report.SettlCurrency = report.getSettlCurrency().getValue();
            ////if (report.isSetHandlInst()) Report.HandlInst = report.getHandlInst().getValue();
            ////if (report.isSetMinQty()) Report.MinQty = report.getMinQty().getValue();
            ////if (report.isSetMaxFloor()) Report.MaxFloor = report.getMaxFloor().getValue();
            //if (report.isSetOpenClose             ()) Report.OpenClose              = report.getOpenClose             ().getValue();
            ////if (report.isSetMaxShow()) Report.MaxShow = report.getMaxShow().getValue();
            if (report.isSetText())
            {
                Report.Text = report.getText().getValue();
            }
            ////if (report.isSetEncodedTextLen()) Report.EncodedTextLen = report.getEncodedTextLen().getValue();
            ////if (report.isSetEncodedText()) Report.EncodedText = report.getEncodedText().getValue();
            //if (report.isSetFutSettDate2          ()) Report.FutSettDate2           = report.getFutSettDate2          ().getValue();
            ////if (report.isSetOrderQty2()) Report.OrderQty2 = report.getOrderQty2().getValue();
            //if (report.isSetClearingFirm          ()) Report.ClearingFirm           = report.getClearingFirm          ().getValue();
            //if (report.isSetClearingAccount       ()) Report.ClearingAccount        = report.getClearingAccount       ().getValue();
            ////if (report.isSetMultiLegReportingType()) Report.MultiLegReportingType = report.getMultiLegReportingType().getValue();

            //

            SingleOrder order;

            if (Report.ExecType == SmartQuant.FIX.ExecType.PendingCancel ||
                Report.ExecType == SmartQuant.FIX.ExecType.Cancelled ||
                Report.ExecType == SmartQuant.FIX.ExecType.PendingReplace ||
                Report.ExecType == SmartQuant.FIX.ExecType.Replace)
            {
                order = OrderManager.Orders.All[Report.OrigClOrdID] as SingleOrder;
            }
            else
            {
                order = OrderManager.Orders.All[Report.ClOrdID] as SingleOrder;
            }

            Instrument instrument = order.Instrument;

            Report.Symbol = instrument.Symbol;

            Report.TransactTime = Clock.Now;

            // emit execution report

            EmitExecutionReport(Report);
        }
        public void ParseFixLog(string FixLogPath)
        {
            if (!File.Exists(FixLogPath))
            {
                Console.WriteLine("File does not Exist");
                return;
            }

            TextReader tr = new StreamReader(FixLogPath);

            string currentMessage = tr.ReadLine();
            int    count          = 0;

            while (currentMessage != null)
            {
                if (/*msgIsToday(currentMessage) &&*/ msgIsOfInterest(currentMessage))
                {
                    QuickFix42.ExecutionReport FixMsg = getMessageTypeObject(currentMessage);

                    if (FixMsg == null)
                    {
                        continue;
                    }

                    FixMsg.setField(57, "7857955");
                    FixMsg.setField(76, "RANE");

                    //break message into pieces
                    string[] msgFields = currentMessage.Split(FixElementDelimeter);
                    //loadPieces
                    foreach (string field in msgFields)
                    {
                        string[] elements = field.Split('=');
                        if (elements.Count() < 2 || elements[0].Equals("10") || elements[0].Equals("8") || elements[0].Equals("9") ||
                            elements[0].Equals("35") || elements[0].Equals("34"))    /* || elements[0].Equals("49") || elements[0].Equals("52")
                                                                                     || elements[0].Equals("56"))*/
                        {
                            continue;
                        }

                        if (elements[0].Equals("1"))
                        {
                            FixMsg.setField(1, "54321");
                        }
                        else
                        {
                            FixMsg.setField(int.Parse(elements[0]), elements[1]);
                        }
                    }
                    //todo:PARSER 03-02 either add message to dictionary or send to logger

                    //logger.logMsg("PManger 1", FixMsg);
                    addToDictionary(FixMsg);
                }
                //if (count > 200)
                //{
                //    Thread.Sleep(500);
                //    count = 0;
                //}

                currentMessage = tr.ReadLine();
                count++;
            }

            Console.WriteLine("Loading log complete...");
            //passtoLogger();
        }
示例#16
0
 // Methods
 public ExecutionReportEventArgs(QuickFix42.ExecutionReport report)
 {
     this.report = report;
 }
示例#17
0
  public override void onMessage( QuickFix42.NewOrderSingle order, SessionID sessionID )
  {
    Symbol symbol = new Symbol();
    Side side = new Side();
    OrdType ordType = new OrdType();
    OrderQty orderQty = new OrderQty();
    Price price = new Price();
    ClOrdID clOrdID = new ClOrdID();

    order.get( ordType );

    if ( ordType.getValue() != OrdType.LIMIT )
      throw new IncorrectTagValue( ordType.getField() );

    order.get( symbol );
    order.get( side );
    order.get( orderQty );
    order.get( price );
    order.get( clOrdID );

    QuickFix42.ExecutionReport executionReport = new QuickFix42.ExecutionReport
                                            ( genOrderID(),
                                              genExecID(),
                                              new ExecTransType( ExecTransType.NEW ),
                                              new ExecType( ExecType.FILL ),
                                              new OrdStatus( OrdStatus.FILLED ),
                                              symbol,
                                              side,
                                              new LeavesQty( 0 ),
                                              new CumQty( orderQty.getValue() ),
                                              new AvgPx( price.getValue() ) );

    executionReport.set( clOrdID );
    executionReport.set( orderQty );
    executionReport.set( new LastShares( orderQty.getValue() ) );
    executionReport.set( new LastPx( price.getValue() ) );

    if( order.isSetAccount() )
      executionReport.set( order.getAccount() );

    try
    {
      Session.sendToTarget( executionReport, sessionID );
    }
    catch ( SessionNotFound ) {}
  }
示例#18
0
 public sealed override void onMessage(QuickFix42.ExecutionReport message, SessionID session)
 {
     Fix.Out(new StackTrace(new StackFrame(true)).GetFrame(0).GetMethod().ToString());
     MsgExecutionReport(message, session);
 }