Ejemplo n.º 1
0
        public void HandleExecutionReport(QuickFix.FIX42.ExecutionReport msg)
        {
            try
            {
                string execId    = msg.ExecID.Obj;
                string transType = FixEnumTranslator.Translate(msg.ExecTransType);
                string execType  = FixEnumTranslator.Translate(msg.ExecType);

                Trace.WriteLine("EVM: Handling ExecutionReport: " + execId + " / " + transType + " / " + execType);

                String securityType = "";
                if (msg.IsSetField(167))
                {
                    securityType = FixEnumTranslator.Translate(msg.SecurityType);
                }

                String putOrCall = "";
                if (msg.IsSetField(201))
                {
                    putOrCall = FixEnumTranslator.Translate(msg.PutOrCall);
                }

                decimal strikePrice = 0;
                if (msg.IsSetField(202))
                {
                    strikePrice = msg.StrikePrice.Obj;
                }

                ExecutionRecord exRec = new ExecutionRecord(
                    msg.ExecID.Obj,
                    msg.OrderID.Obj,
                    transType,
                    execType,
                    msg.Symbol.Obj,
                    FixEnumTranslator.Translate(msg.Side),
                    securityType,
                    putOrCall,
                    strikePrice);

                SmartDispatcher.Invoke(new Action <ExecutionRecord>(AddExecution), exRec);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
            }
        }
        public void HandleExecutionReport(QuickFix.FIX42.ExecutionReport msg)
        {
            try
            {
                if (msg.IsSetField(11) && msg.ClOrdID != null)
                {
                    string clOrdId = msg.ClOrdID.Obj;


                    string status = FixEnumTranslator.Translate(msg.OrdStatus);

                    //Trace.WriteLine("OVM: Handling ExecutionReport: " + clOrdId + " / " + status);

                    lock (_ordersLock)
                    {
                        foreach (OrderRecord r in Orders)
                        {
                            if (r.ClOrdID == clOrdId)
                            {
                                r.Status = status;
                                if (msg.IsSetLastPx())
                                {
                                    r.Price = msg.LastPx.Obj;
                                }
                                if (msg.IsSetOrderID())
                                {
                                    r.OrderID = msg.OrderID.Obj;
                                }

                                return;
                            }
                        }
                    }

                    //Trace.WriteLine("OVM: No order corresponds to ClOrdID '" + clOrdId + "'");
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
            }
        }