Beispiel #1
0
        public void FromAdmin(QuickFix.Message message, QuickFix.SessionID sessionID)
        {
            if (message.Header.GetString(35) == QuickFix.FIX42.Reject.MsgType)
            {
                Console.WriteLine("REJECT RECEIVED: " + message.ToString());
            }

            Trace.WriteLine("## FromAdmin: " + message.ToString());
            if (MessageEvent != null)
            {
                MessageEvent(message, true);
            }
        }
Beispiel #2
0
        private static IEnumerable <FixField> ListFields(Message msg)
        {
            var str   = msg.ToString();
            var parts = str.Split(new[] { '\x01' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var part in parts)
            {
                var i = part.IndexOf('=');
                if (i < 0)
                {
                    continue;
                }

                var name  = part.Substring(0, i);
                var value = part.Substring(i + 1);

                int.TryParse(name, out var tag);
                if (_Fields.TryGetValue(tag, out var tagName))
                {
                    name = tagName;
                }

                if (_FieldFormatters.TryGetValue(tag, out var formatter))
                {
                    value = formatter(value);
                }

                yield return(new FixField
                {
                    Name = name,
                    Value = value
                });
            }
        }
Beispiel #3
0
        private void SendTheMessage(QuickFix.Message msg)
        {
            msg.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID));
            msg.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID));
            msg.Header.SetField(new QuickFix.Fields.MsgSeqNum(seqNum++));

            session.Next(msg.ToString());
        }
Beispiel #4
0
 public void ToApp(QuickFix.Message message, QuickFix.SessionID sessionId)
 {
     _strategy.ProcessToApp(message, QuickFix.Session.LookupSession(sessionId));
     Trace.WriteLine("## ToApp: " + message.ToString());
     if (MessageEvent != null)
     {
         MessageEvent(message, false);
     }
 }
Beispiel #5
0
 private void SendLogon(QuickFix.Message msg)
 {
     msg.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID));
     msg.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID));
     msg.Header.SetField(new QuickFix.Fields.MsgSeqNum(seqNum++));
     msg.Header.SetField(new QuickFix.Fields.SendingTime(System.DateTime.UtcNow));
     msg.SetField(new QuickFix.Fields.HeartBtInt(1));
     session.Next(msg.ToString());
 }
Beispiel #6
0
 public void ToAdmin(QuickFix.Message msg, SessionID sessionID)
 {
     if (msg.Header.GetField(35).ToString() == "A")
     {
         msg.SetField(new QuickFix.Fields.Username(username));
         msg.SetField(new QuickFix.Fields.Password(password));
     }
     AddToAdmin("TO ADMIN: " + msg.ToString(), null);
 }
Beispiel #7
0
 public void FromApp(QuickFix.Message message, QuickFix.SessionID sessionID)
 {
     Trace.WriteLine("## FromApp: " + message.ToString());
     if (MessageEvent != null)
     {
         MessageEvent(message, true);
     }
     Crack(message, sessionID);
 }
Beispiel #8
0
        public static string ToString(this Message msg, bool parse = false)
        {
            if (!parse)
            {
                return(msg.ToString());
            }
            StringBuilder stringBuilder = new StringBuilder();
            var           ObjRef        = msg.GetType();

            stringBuilder.AppendLine(ObjRef.Name);
            foreach (var property in ObjRef.GetProperties())
            {
                try
                {
                    object upValue = property.GetValue(msg);
                    object value   = property.PropertyType.GetProperty("Obj").GetValue(upValue);

                    //Check and fiil static fileds used like enum
                    var StaticFiels = property.PropertyType
                                      .GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
                                      .Where(p => p.IsLiteral && !p.IsInitOnly).GroupBy(p => p.GetRawConstantValue(), v => v.Name)
                                      .ToDictionary(group => group.Key, group => group.Aggregate(
                                                        (res, add) => $"{add}  or  {res}"));

                    if (StaticFiels.Count > 0 && StaticFiels.ContainsKey(value))
                    {
                        value = $"{value} ({StaticFiels[value]})";
                    }

                    stringBuilder.AppendLine($"\t{property.Name}: {value}");
                }
                catch (Exception e)
                {
                }
            }
            return(stringBuilder.ToString());
        }
Beispiel #9
0
        /// <summary>
        /// Cancel the order specified
        /// </summary>
        /// <param name="myID">ID of order to cancel</param>
        public void CancelOrder(string myID)
        {
            try
            {
                // Get Order
                KaiTrade.Interfaces.OrderManager myOM = AppFactory.Instance().GetOrderManager();
                KaiTrade.Interfaces.Order myOrder = myOM.GetOrder(myID);

                if (myOrder == null)
                {
                    string myError = "Order not found cannot cancel:" + myID;
                    Exception myE = new Exception(myError);
                }

                if (m_ORLog.IsInfoEnabled)
                {
                    m_ORLog.Info("CancelOrder:" + myOrder.ToString());
                }

                if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.cancel)
                {
                    string myError = "Order has already had a cancel processed - cannot recancel:" + myID;
                    Exception myE = new Exception(myError);
                }

                // Is this a triggered order
                if (myOrder.TriggerOrderID.Length > 0)
                {
                    KaiTrade.Interfaces.TriggeredOrder triggeredOrder = KTAFacade.Instance().Factory.GetTriggeredOrderManager().Get(myOrder.TriggerOrderID);
                    triggeredOrder.Cancel();
                    return;
                }
                // store the clordID's
                //NOT USED? QuickFix.OrigClOrdID myOrigClOrdID;
                QuickFix.ClOrdID myClOrdID;

                if ((myOrder.OrdStatus.getValue() == QuickFix.OrdStatus.FILLED) || (myOrder.OrdStatus.getValue() == QuickFix.OrdStatus.CANCELED))
                {
                    // cannot cancel the order - so return
                    return;
                }

                // Create a FIX cancel messsage

                QuickFix.Message myFixMsg = new QuickFix.Message();
                QuickFix.MsgType msgType = new QuickFix.MsgType("F");
                myFixMsg.getHeader().setField(msgType);
                QuickFix.BeginString myBeginString = new QuickFix.BeginString("FIX.4.4");
                myFixMsg.getHeader().setField(myBeginString);

                // set the original to the existing clordid
                myOrder.OrigClOrdID = new QuickFix.OrigClOrdID(myOrder.ClOrdID.getValue());
                myFixMsg.setField(myOrder.OrigClOrdID);

                // save the existing clordid and set the new clordid
                myClOrdID = myOrder.ClOrdID;
                myOrder.ClOrdID = new QuickFix.ClOrdID(KaiUtil.Identities.Instance.genReqID());
                myFixMsg.setField(myOrder.ClOrdID);
                // Associate the CLOrdID with this order
                AppFactory.Instance().GetOrderManager().AssociateClOrdID(myOrder.ClOrdID.getValue(), myOrder);

                // OrderID
                if (myOrder.OrderID != null)
                {
                    myFixMsg.setField(myOrder.OrderID);
                }

                ////Side
                myFixMsg.setField(myOrder.Side);

                // set up the product details in the message
                myOrder.Product.Set(myFixMsg);

                //// Transact Time
                myOrder.TransactTime = new QuickFix.TransactTime(DateTime.Now.ToUniversalTime());
                myFixMsg.setField(myOrder.TransactTime);

                // Create the message wrapper used to send the order cancel to the driver
                KaiTrade.Interfaces.Message myMsg = new KaiTCPComm.KaiMessageWrap();

                myMsg.Label = "F";

                string myDriverCode = "";
                // A trade venue must be specified on the order
                KaiTrade.Interfaces.Venue myVenue = null;
                if (myOrder.Product.TradeVenue.Length > 0)
                {
                    // get the driver code and session details from the venue manager
                    myVenue = AppFactory.Instance().GetVenueManager().GetVenue(myOrder.Product.TradeVenue);
                    if (myVenue != null)
                    {
                        myDriverCode = myVenue.DriverCode;
                        if (myVenue.TargetVenue.Length > 0)
                        {
                            myMsg.VenueCode = myVenue.TargetVenue;
                        }
                        if (myVenue.BeginString.Length > 0)
                        {
                            // this is the FIX version the server wants, we convert between
                            // versions in the FIX client
                            myMsg.Format = myVenue.BeginString;
                        }

                        if (myVenue.SID.Length > 0)
                        {
                            QuickFix.SenderCompID mySID = new QuickFix.SenderCompID(myVenue.SID);
                            myFixMsg.getHeader().setField(mySID);
                            myMsg.ClientID = myVenue.SID;
                        }
                        if (myVenue.TID.Length > 0)
                        {
                            QuickFix.TargetCompID myTID = new QuickFix.TargetCompID(myVenue.TID);
                            myFixMsg.getHeader().setField(myTID);
                            myMsg.TargetID = myVenue.TID;
                        }
                    }
                    else
                    {
                        string myErr = "Invalid Venue Code:" + myOrder.Product.TradeVenue;
                        m_Log.Error(myErr);
                        Exception myE = new Exception(myErr);
                        throw myE;
                    }
                }
                else
                {
                    string myErr = "No Venue Code specified on product:";
                    m_Log.Error(myErr);
                    Exception myE = new Exception(myErr);
                    throw myE;
                }

                // process any venue field bags - do this prior to the order bags
                // to allow the order setting to override the venues
                List<KaiTrade.Interfaces.Field> myFieldBag;
                KTAFacade.Instance().SetBag(out myFieldBag, myVenue.CancelBag, ",");

                foreach (KaiTrade.Interfaces.Field myField in myFieldBag)
                {
                    try
                    {
                        myFixMsg.setString(int.Parse(myField.ID), myField.Value);
                    }
                    catch (Exception myE)
                    {
                        m_Log.Error("cancel Extra tags from venue error:", myE);
                    }
                }

                // process any additional tags for the order
                foreach (KaiTrade.Interfaces.Field myField in myOrder.CancelBag)
                {
                    try
                    {
                        myFixMsg.setString(int.Parse(myField.ID), myField.Value);
                    }
                    catch (Exception myE)
                    {
                        m_Log.Error("cancel Extra tags error:", myE);
                    }
                }
                if (myOrder.Account != null)
                {
                    if (myOrder.Account.getValue().Length > 0)
                    {
                        myFixMsg.setField(myOrder.Account);
                    }
                }
                // Set the FIX string as message data
                myMsg.Data = myFixMsg.ToString();

                // inform order manager clients that the order has changed
                myOM.SetChanged(myOrder.Identity);

                try
                {
                    //Send the message
                    KaiTrade.Interfaces.Driver myDrv = AppFactory.Instance().GetDriverManager().GetDriver(myDriverCode);
                    if (myDrv != null)
                    {
                        // send the message for processing
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.cancel;

                        //SendDelegate mySend = new SendDelegate(myDrv.Send);
                        //IAsyncResult ar = mySend.BeginInvoke(myMsg, SRCallback, "123456789");
                        // send the message for processing
                        myDrv.Send(myMsg);
                    }
                    else
                    {
                        string myError = "Driver not found for code:" + myDriverCode;
                        m_Log.Error(myError);
                        Exception myE = new Exception(myError);
                        throw myE;
                    }
                }
                catch (Exception myE)
                {
                    m_Log.Error("CanceltOrder:" + myOrder.Identity, myE);
                    myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.REJECTED);
                    order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                    throw (myE);
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("CancelOrder:", myE);
                throw (myE);
            }
        }
Beispiel #10
0
 public void ToApp(QuickFix.Message msg, SessionID sessionID)
 {
     AddToLB("TO APP: " + msg.ToString(), null);
 }
Beispiel #11
0
        /// <summary>
        /// Handle an incomming execution report
        /// </summary>
        /// <param name="myMsg"></param>
        public void HandleExecReport(KaiTrade.Interfaces.Message myMsg)
        {
            try
            {
                if (m_Log.IsInfoEnabled)
                {
                    m_Log.Info("OrderService:HandleExecReport:" + myMsg.Data);
                }
                if (m_ORLog.IsInfoEnabled)
                {
                    m_ORLog.Info("OrderService:HandleExecReport:" + myMsg.Data);
                }
                // Get order manager
                KaiTrade.Interfaces.OrderManager myOM = KTAFacade.Instance().Factory.GetOrderManager();

                //Create a quickfix message object
                QuickFix.Message myFixMsg = new QuickFix.Message(myMsg.Data);

                QuickFix.ExecID myExecID = new QuickFix.ExecID();
                myFixMsg.getField(myExecID);

                // check if we have already processed this report
                if (!myOM.RecordExecutionReport(myExecID.getValue(), myFixMsg))
                {
                    // we have processed this already
                    m_Log.Warn("HandleExecReport: Duplicate Exec Report:" + myMsg.Data);
                    return;
                }

                // these fields must be present
                QuickFix.OrderID myOrderID = new QuickFix.OrderID();
                myFixMsg.getField(myOrderID);

                QuickFix.ExecType myExecType = new QuickFix.ExecType();
                myFixMsg.getField(myExecType);

                QuickFix.OrdStatus myOrdStatus = new QuickFix.OrdStatus();
                myFixMsg.getField(myOrdStatus);

                // we need the clordid to update an existing order - if
                // it is not present or unknow we create a synthetic order
                QuickFix.ClOrdID myClOrdID = new QuickFix.ClOrdID();
                KaiTrade.Interfaces.Order myOrder = null;
                if (myFixMsg.isSetField(myClOrdID))
                {
                    myFixMsg.getField(myClOrdID);
                    myOrder = myOM.GetOrderWithClOrdIDID(myClOrdID.getValue());
                }
                if (myOrder == null)
                {
                    myOrder = CreateSyntheticOrder(myFixMsg);
                }

                // add the ExecRep to the Order
                KaiTrade.Interfaces.Fill myFill = new K2DataObjects.FillData();
                myFill.OrderID = myOrder.Identity;
                myFill.SetUpFromFixExecReport(myFixMsg.ToString());

                myOrder.FillsList.Add(myFill);

                // update mandatory fields
                myOrder.OrderID = myOrderID;
                myOrder.OrdStatus = myOrdStatus;
                QuickFix.Text myText = new QuickFix.Text();
                if (myFixMsg.isSetField(myText))
                {
                    myFixMsg.getField(myText);
                    myOrder.Text = myText.getValue();
                }

                QuickFix.Account myAccount = new QuickFix.Account();
                if (myFixMsg.isSetField(myAccount))
                {
                    myFixMsg.getField(myAccount);

                    myOrder.Account = myAccount;
                }

                // process the execution depanding on type of ExecReport
                switch (myExecType.getValue())
                {
                    case QuickFix.ExecType.NEW:
                        processGeneralExecRep(ref myOrder, myFixMsg);
                        /*
                        if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
                        {
                            order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                        }
                        else
                        {
                            m_Log.Error("HandleExecReport:OrderStatus new not expected");
                        }
                         * */
                        break;
                    case QuickFix.ExecType.FILL:
                        if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
                        {
                            order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                        }

                        processFill(ref myOrder, myFixMsg);
                        break;
                    case QuickFix.ExecType.PARTIAL_FILL:
                        if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.neworder)
                        {
                            order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.none;
                        }
                        processFill(ref myOrder, myFixMsg);
                        break;
                    case QuickFix.ExecType.ORDER_STATUS:
                        processGeneralExecRep(ref myOrder, myFixMsg);
                        break;
                    default:
                        processGeneralExecRep(ref myOrder, myFixMsg);
                        break;
                }

                myOM.SetChanged(myOrder.Identity);

                // Check if the order is part of a strategy
                if (myOrder.ParentIdentity != null)
                {
                    // get the strategy concerned
                    KaiTrade.Interfaces.IStrategy myStrat = KTAFacade.Instance().Factory.GetStrategyManager().GetStrategy(myOrder.ParentIdentity);
                    if (myStrat != null)
                    {
                        myStrat.HandleExecReport(myFixMsg, myOrder);
                    }
                    else
                    {
                        m_Log.Error("Strategy not found for:" + myOrder.ParentIdentity);
                    }
                }

                if (myOrder.OCAGroupName.Length > 0)
                {
                    KTAFacade.Instance().Factory.GetOCOManager().OnOrderTraded(myOrder);
                }
                if (m_ORLog.IsInfoEnabled)
                {
                    m_ORLog.Info("OrderService:HandleExecRep:Exit:" + myOrder.ToString());
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("HandleExecReport", myE);
            }
        }
Beispiel #12
0
 internal static void ReplicateFixMessage(QuickFix.Message msg)
 {
     try
     {
         lock (m_LockedObj)
         {
             string msgTypeString   = msg.getHeader().getField(m_msgTypeTag);
             Guid[] subscribersKeys = GetFixMsgSubscribers(msgTypeString);
             if (subscribersKeys != null && subscribersKeys.Length > 0)
             {
                 foreach (Guid key in subscribersKeys)
                 {
                     PushUpdates(new IReplicationResponse[] { new ReplicatedFixMsg()
                                                              {
                                                                  ClientKey = key, FixMessage = msg.ToString(), ResponseDateTime = DateTime.Now, FixVersion = msg.getHeader().getField(m_fixMsgVersionTag)
                                                              } });
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Counters.IncrementCounter(CountersConstants.ExceptionMessages);
         SystemLogger.WriteOnConsoleAsync(true, string.Format("ReplicateFixMessage, Error: {0} ", ex.Message), ConsoleColor.Red, ConsoleColor.Black, true);
     }
 }
 public void ToApp(QuickFix.Message msg, QuickFix.SessionID sessionID)
 {
     m_logger.Info(sessionID.SenderCompID, " ToApp msg : " + msg.ToString());
     // Crack(msg, sessionID);
 }
Beispiel #14
0
        public void RenderOrderAsFix(out QuickFix.Message myNOS, out KaiTrade.Interfaces.Message myMsg, out string myDriverCode, KaiTrade.Interfaces.Order myOrder)
        {
            try
            {
                lock (this)
                {
                    // do not actually submit triggered orders

                    // register the order as a publisher
                    KaiTrade.Interfaces.Publisher myPub = null;
                    myPub = AppFactory.Instance().GetPublisherManager().GetPublisher(myOrder.Identity);
                    if (myPub == null)
                    {
                        myPub = myOrder as KaiTrade.Interfaces.Publisher;
                        AppFactory.Instance().GetPublisherManager().Add(myPub);
                    }

                    // Check the limits for the order
                    string myTextErr;
                    if (LimitChecker.Instance().BreaksLimits(out myTextErr, myOrder))
                    {
                        myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.REJECTED);
                        myOrder.Text = "order failed order qty limit test";
                        Exception myE = new Exception("process order failed order qty limit test");
                        throw myE;
                    }

                    // Create the FIX order message
                    myNOS = new QuickFix.Message();

                    // pending new at this stage
                    myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.PENDING_NEW);

                    myOrder.TransactTime = new QuickFix.TransactTime(DateTime.Now.ToUniversalTime());
                    myNOS.setField(myOrder.TransactTime);

                    //myOrder.ClOrdID = new QuickFix.ClOrdID(KaiUtil.Identities.Instance.genReqID());

                    // Associate the CLOrdID with this order
                    AppFactory.Instance().GetOrderManager().AssociateClOrdID(myOrder.ClOrdID.getValue(), myOrder);

                    // Set fix version
                    QuickFix.BeginString myBeginString = new QuickFix.BeginString("FIX.4.4");
                    myNOS.getHeader().setField(myBeginString);

                    // Set order message type
                    QuickFix.MsgType msgType = new QuickFix.MsgType();
                    msgType.setValue("D");
                    myNOS.getHeader().setField(msgType);

                    myNOS.setField(myOrder.ClOrdID);

                    // set up the product details in the message
                    myOrder.Product.Set(myNOS);

                    // Qty
                    myNOS.setField(myOrder.OrderQty);

                    // MaxFloor
                    if (myOrder.MaxFloor != null)
                    {
                        myNOS.setField(myOrder.MaxFloor);
                    }

                    // set the side
                    myNOS.setField(myOrder.Side);

                    // set the order type
                    myNOS.setField(myOrder.OrdType);

                    // Time in force
                    if (myOrder.TimeInForce != null)
                    {
                        myNOS.setField(myOrder.TimeInForce);
                    }
                    else
                    {
                        myOrder.TimeInForce = new QuickFix.TimeInForce(QuickFix.TimeInForce.DAY);
                        myNOS.setField(myOrder.TimeInForce);
                    }

                    // Validation - check they entered a date/time if needed
                    switch (myOrder.TimeInForce.getValue())
                    {
                        case QuickFix.TimeInForce.GOOD_TILL_DATE:
                            break;

                        default:
                            break;
                    }

                    // do not add the price to the fix message on Market orders
                    if (myOrder.OrdType.getValue() != QuickFix.OrdType.MARKET)
                    {
                        if (myOrder.Price.getValue() > 0)
                        {
                            myNOS.setField(myOrder.Price);
                        }
                        else
                        {
                            throw new Exception("Must specify price > 0 on Limit and other non Market orders");
                        }
                    }

                    if (myOrder.StopPx != null)
                    {
                        myNOS.setField(myOrder.StopPx);
                    }

                    // default the handlInst to automated
                    if (myOrder.HandlInst != null)
                    {
                        myNOS.setField(myOrder.HandlInst);
                    }
                    else
                    {
                        myOrder.HandlInst = new QuickFix.HandlInst(QuickFix.HandlInst.AUTOEXECPUB);
                        myNOS.setField(myOrder.HandlInst);
                    }

                    // Create the message wrapper used to send the order to the driver
                    myMsg = new KaiTCPComm.KaiMessageWrap();

                    myMsg.Label = "D";

                    myDriverCode = "";
                    // A trade venue must be specified on the order
                    KaiTrade.Interfaces.Venue myVenue = null;
                    if (myOrder.Product.TradeVenue.Length > 0)
                    {
                        // get the driver code and session details from the venue manager
                        myVenue = AppFactory.Instance().GetVenueManager().GetVenue(myOrder.Product.TradeVenue);
                        if (myVenue != null)
                        {
                            myDriverCode = myVenue.DriverCode;
                            if (myVenue.TargetVenue.Length > 0)
                            {
                                myMsg.VenueCode = myVenue.TargetVenue;
                            }
                            if (myVenue.BeginString.Length > 0)
                            {
                                // this is the FIX version the server wants, we convert between
                                // versions in the FIX client
                                myMsg.Format = myVenue.BeginString;
                            }

                            if (myVenue.SID.Length > 0)
                            {
                                QuickFix.SenderCompID mySID = new QuickFix.SenderCompID(myVenue.SID);
                                myNOS.getHeader().setField(mySID);
                                myMsg.ClientID = myVenue.SID;
                            }
                            if (myVenue.TID.Length > 0)
                            {
                                QuickFix.TargetCompID myTID = new QuickFix.TargetCompID(myVenue.TID);
                                myNOS.getHeader().setField(myTID);
                                myMsg.TargetID = myVenue.TID;
                            }
                        }
                        else
                        {
                            string myErr = "Invalid Venue Code:" + myOrder.Product.TradeVenue;
                            m_Log.Error(myErr);
                            Exception myE = new Exception(myErr);
                            throw myE;
                        }
                    }
                    else
                    {
                        string myErr = "No Venue Code specified on product:";
                        m_Log.Error(myErr);
                        Exception myE = new Exception(myErr);
                        throw myE;
                    }

                    // process any venue field bags - do this prior to the order bags
                    // to allow the order setting to override the venues
                    List<KaiTrade.Interfaces.Field> myFieldBag;
                    KTAFacade.Instance().SetBag(out myFieldBag, myVenue.NOSBag, ",");
                    foreach (KaiTrade.Interfaces.Field myField in myFieldBag)
                    {
                        try
                        {
                            myNOS.setString(int.Parse(myField.ID), myField.Value);
                        }
                        catch (Exception myE)
                        {
                            m_Log.Error("NOS Extra tags from venue error:", myE);
                        }
                    }

                    // process any additional tags for the order
                    foreach (KaiTrade.Interfaces.Field myField in myOrder.NOSBag)
                    {
                        try
                        {
                            myNOS.setString(int.Parse(myField.ID), myField.Value);
                        }
                        catch (Exception myE)
                        {
                            m_Log.Error("NOS Extra tags error:", myE);
                        }
                    }

                    // additional setting placed here will override the
                    // fields in the bags

                    if (myOrder.Account != null)
                    {
                        if (myOrder.Account.getValue().Length > 0)
                        {
                            myNOS.setField(myOrder.Account);
                        }
                    }

                    QuickFix.TargetStrategyParameters targetStrategyParameters = new QuickFix.TargetStrategyParameters(myOrder.StrategyName);
                    myNOS.setField(targetStrategyParameters);

                    // Process any strategy parameters
                    if (myOrder.K2Parameters.Count > 0)
                    {
                        QuickFix.NoStrategyParameters noStratParms = new QuickFix.NoStrategyParameters(myOrder.K2Parameters.Count);
                        myNOS.setField(noStratParms);
                        QuickFix50Sp2.NewOrderSingle.NoStrategyParameters group = new QuickFix50Sp2.NewOrderSingle.NoStrategyParameters();
                        QuickFix.StrategyParameterName strategyParameterName;
                        QuickFix.StrategyParameterType strategyParameterType;
                        QuickFix.StrategyParameterValue strategyParameterValue;

                        foreach (KaiTrade.Interfaces.K2Parameter param in myOrder.K2Parameters)
                        {
                            strategyParameterName = new QuickFix.StrategyParameterName(param.ParameterName);
                            group.setField(strategyParameterName);
                            strategyParameterType = new QuickFix.StrategyParameterType((int)param.ParameterType);
                            group.setField(strategyParameterType);
                            strategyParameterValue = new QuickFix.StrategyParameterValue(param.ParameterValue);
                            group.setField(strategyParameterValue);
                            myNOS.addGroup(group);
                        }
                    }

                    // Set the FIX string as message data
                    myMsg.Data = myNOS.ToString();

                    // inform order manager clients that the order has changed
                    AppFactory.Instance().GetOrderManager().SetChanged(myOrder.Identity);
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("RenderOrderAsFix:", myE);
                myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.REJECTED);
                myOrder.Text = myE.Message;
                // inform order manager clients that the order has changed
                AppFactory.Instance().GetOrderManager().SetChanged(myOrder.Identity);
                throw (myE);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Edit the order for the ID specified - throws an exception if the order isnt working
        /// </summary>
        /// <param name="myID"></param>
        /// <param name="newQty">new qty if specified</param>
        /// <param name="newPrice">new price if specified</param>
        public void ReplaceOrder(string myID, double? newQty, double? newPrice, double? newStopPx)
        {
            KaiTrade.Interfaces.Order myOrder = null;
            try
            {
                // Get Order
                KaiTrade.Interfaces.OrderManager myOM = AppFactory.Instance().GetOrderManager();
                myOrder = myOM.GetOrder(myID);
                if (myOrder == null)
                {
                    string myError = "Order not found cannot edit:" + myID;
                    Exception myE = new Exception(myError);
                    throw myE;
                }
                if (m_ORLog.IsInfoEnabled)
                {
                    m_ORLog.Info("ReplaceOrder:"+ myOrder.ToString());
                }
                // are these changes?
                if (!newValueDifferentFromOld(myOrder, newQty, newPrice, newStopPx))
                {
                    string myError = "The new fields in the Replace request are the same as the existing fields" + myID;
                    Exception myE = new Exception(myError);
                    throw myE;
                }
                // Is this a triggered order
                if (myOrder.TriggerOrderID.Length > 0)
                {
                    if (newQty.HasValue)
                    {
                        myOrder.OrderQty = new QuickFix.OrderQty((double)newQty);
                    }

                    if (newPrice.HasValue)
                    {
                        myOrder.Price = new QuickFix.Price((double)newPrice);
                    }
                    if (newStopPx.HasValue)
                    {
                        myOrder.StopPx = new QuickFix.StopPx((double)newStopPx);
                    }
                    return;
                }
                // store the clordID's
                //NOT USED? QuickFix.OrigClOrdID myOrigClOrdID;
                QuickFix.ClOrdID myClOrdID;

                // check if we are pending cancel or pending mod
                if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.replace)
                {
                    // we are currently doing a replace - cannot do another
                    string myError = "Order is already processing a replace cannot modify at this time:" + myID;
                    Exception myE = new Exception(myError);
                    throw myE;
                }

                if (order.LastOrderCommand == KaiTrade.Interfaces.LastOrderCommand.cancel)
                {
                    // we are currently doing a cancel - cannot do a mod
                    string myError = "Order is already processing a cancel cannot modify" + myID;
                    Exception myE = new Exception(myError);
                    throw myE;
                }

                // check that the order is working
                if (!myOrder.IsWorking())
                {
                    if ((myOrder.OrdType.getValue() == QuickFix.OrdType.STOP) || (myOrder.OrdType.getValue() == QuickFix.OrdType.STOP_LIMIT))
                    {
                        // no action
                    }
                    else
                    {
                        string myError = "Order is not in a working state cannot replace:" + myID;
                        Exception myE = new Exception(myError);
                        throw myE;
                    }
                }
                // Check the limits for the order
                string myTextErr;
                double qty;
                if (newQty.HasValue)
                {
                    qty = newQty.Value;
                }
                else
                {
                    qty = myOrder.OrderQty.getValue();
                }
                double px;
                if (newPrice.HasValue)
                {
                    px = newPrice.Value;
                }
                else
                {
                    px = myOrder.Price.getValue();
                }
                if (LimitChecker.Instance().BreaksLimits(out myTextErr, myOrder, qty, px))
                {
                    myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.REJECTED);
                    myOrder.Text = "You have exceeded the order qty limit - please re-enter";
                    Exception myE = new Exception("You have exceeded the order qty limit - please re-enter");
                    throw myE;
                }

                // Create a FIX cancel replace messsage

                QuickFix.Message myFixMsg = new QuickFix.Message();
                QuickFix.MsgType msgType = new QuickFix.MsgType("G");
                myFixMsg.getHeader().setField(msgType);
                QuickFix.BeginString myBeginString = new QuickFix.BeginString("FIX.4.4");
                myFixMsg.getHeader().setField(myBeginString);

                // OrderID
                if (myOrder.OrderID == null)
                {
                    myOrder.Text = "No order ID found cannot modify order";
                    Exception myE = new Exception("No order ID found cannot modify order");
                    throw myE;
                }

                // set the original to the existing clordid
                myOrder.OrigClOrdID = new QuickFix.OrigClOrdID(myOrder.ClOrdID.getValue());
                myFixMsg.setField(myOrder.OrigClOrdID);

                myFixMsg.setField(myOrder.OrderID);

                ////Side
                myFixMsg.setField(myOrder.Side);

                // set up the product details in the message
                myOrder.Product.Set(myFixMsg);

                //// Transact Time
                myOrder.TransactTime = new QuickFix.TransactTime(DateTime.Now.ToUniversalTime());
                myFixMsg.setField(myOrder.TransactTime);

                myFixMsg.setField(myOrder.OrdType);

                // Create the message wrapper used to send the order cancel to the driver
                KaiTrade.Interfaces.Message myMsg = new KaiTCPComm.KaiMessageWrap();

                myMsg.Label = "G";

                string myDriverCode = "";
                // A trade venue must be specified on the order
                KaiTrade.Interfaces.Venue myVenue = null;
                if (myOrder.Product.TradeVenue.Length > 0)
                {
                    // get the driver code and session details from the venue manager
                    myVenue = AppFactory.Instance().GetVenueManager().GetVenue(myOrder.Product.TradeVenue);
                    if (myVenue != null)
                    {
                        myDriverCode = myVenue.DriverCode;
                        if (myVenue.TargetVenue.Length > 0)
                        {
                            myMsg.VenueCode = myVenue.TargetVenue;
                        }
                        if (myVenue.BeginString.Length > 0)
                        {
                            // this is the FIX version the server wants, we convert between
                            // versions in the FIX client
                            myMsg.Format = myVenue.BeginString;
                        }

                        if (myVenue.SID.Length > 0)
                        {
                            QuickFix.SenderCompID mySID = new QuickFix.SenderCompID(myVenue.SID);
                            myFixMsg.getHeader().setField(mySID);
                            myMsg.ClientID = myVenue.SID;
                        }
                        if (myVenue.TID.Length > 0)
                        {
                            QuickFix.TargetCompID myTID = new QuickFix.TargetCompID(myVenue.TID);
                            myFixMsg.getHeader().setField(myTID);
                            myMsg.TargetID = myVenue.TID;
                        }
                    }
                    else
                    {
                        string myErr = "Invalid Venue Code:" + myOrder.Product.TradeVenue;
                        m_Log.Error(myErr);
                        Exception myE = new Exception(myErr);
                        throw myE;
                    }
                }
                else
                {
                    string myErr = "No Venue Code specified on product:";
                    m_Log.Error(myErr);
                    Exception myE = new Exception(myErr);
                    throw myE;
                }

                // process any venue field bags - do this prior to the order bags
                // to allow the order setting to override the venues
                List<KaiTrade.Interfaces.Field> myFieldBag;
                KTAFacade.Instance().SetBag(out myFieldBag, myVenue.ReplaceBag, ",");

                foreach (KaiTrade.Interfaces.Field myField in myFieldBag)
                {
                    try
                    {
                        myFixMsg.setString(int.Parse(myField.ID), myField.Value);
                    }
                    catch (Exception myE)
                    {
                        m_Log.Error("replace Extra tags from venue error:", myE);
                    }
                }

                // process any additional tags for the order
                foreach (KaiTrade.Interfaces.Field myField in myOrder.ReplaceBag)
                {
                    try
                    {
                        myFixMsg.setString(int.Parse(myField.ID), myField.Value);
                    }
                    catch (Exception myE)
                    {
                        m_Log.Error("replace Extra tags error:", myE);
                    }
                }
                if (myOrder.Account != null)
                {
                    if (myOrder.Account.getValue().Length > 0)
                    {
                        myFixMsg.setField(myOrder.Account);
                    }
                }

                try
                {
                    //Send the message
                    KaiTrade.Interfaces.Driver myDrv = AppFactory.Instance().GetDriverManager().GetDriver(myDriverCode);
                    if (myDrv != null)
                    {
                        // save the existing clordid and set the new clordid
                        myClOrdID = myOrder.ClOrdID;
                        myOrder.ClOrdID = new QuickFix.ClOrdID(KaiUtil.Identities.Instance.genReqID());
                        myFixMsg.setField(myOrder.ClOrdID);
                        // Associate the CLOrdID with this order
                        AppFactory.Instance().GetOrderManager().AssociateClOrdID(myOrder.ClOrdID.getValue(), myOrder);

                        if (newQty.HasValue)
                        {
                            myOrder.OrderQty = new QuickFix.OrderQty((double)newQty);
                            myFixMsg.setField(myOrder.OrderQty);
                        }

                        if (newPrice.HasValue)
                        {
                            myOrder.Price = new QuickFix.Price((double)newPrice);
                            myFixMsg.setField(myOrder.Price);
                        }
                        if (newStopPx.HasValue)
                        {
                            myOrder.StopPx = new QuickFix.StopPx((double)newStopPx);
                            myFixMsg.setField(myOrder.StopPx);
                        }

                        // Set the FIX string as message data
                        myMsg.Data = myFixMsg.ToString();

                        // inform order manager clients that the order has changed
                        myOM.SetChanged(myOrder.Identity);
                        // send the message for processing
                        //myDrv.Send(myMsg);
                        // send the message for processing
                        order.LastOrderCommand = KaiTrade.Interfaces.LastOrderCommand.replace;
                        //SendDelegate mySend = new SendDelegate(myDrv.Send);
                        //IAsyncResult ar = mySend.BeginInvoke(myMsg, SRCallback, "123456789");
                        myDrv.Send(myMsg);
                    }
                    else
                    {
                        string myError = "Driver not found for code:" + myDriverCode;
                        m_Log.Error(myError);
                        Exception myE = new Exception(myError);
                        throw myE;
                    }
                }
                catch (Exception myE)
                {
                    m_Log.Error("EditOrder:Sendnessage part" + myOrder.Identity, myE);
                    myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.REJECTED);
                    throw (myE);
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("ReplaceOrder:", myE);
                if (myOrder != null)
                {
                    myOrder.OrdStatus = new QuickFix.OrdStatus(QuickFix.OrdStatus.REJECTED);
                    myOrder.Text = myE.Message;
                }
                throw (myE);
            }
        }
Beispiel #16
0
 public static string PrettyPrint(this Message msg)
 {
     return(msg.ToString().Replace(Message.SOH, "|"));
 }
 public void FromAdmin(QuickFix.Message msg, SessionID sessionID)
 {
     _form1.logListView.Items.Add(msg.ToString());
 }
Beispiel #18
0
 public MessageRecord(QuickFix.Message msg, bool isIncoming)
 {
     MsgText   = msg.ToString().Replace(QuickFix.Message.SOH, "|");
     Direction = isIncoming ? "IN" : "OUT";
     Timestamp = msg.Header.GetDateTime(QuickFix.Fields.Tags.SendingTime);
 }
Beispiel #19
0
 public void FromAdmin(QuickFix.Message msg, SessionID sessionID)
 {
     AddToAdmin("FROM ADMIN: " + msg.ToString(), null);
 }
        public void DisplayMessageInfo(QuickFix.Message message, Entry entry = null)
        {
            if (message != null)
            {
                messageDetailsList.Items.Clear();

                foreach (var h in message.Header)
                {
                    var ddf   = _fieldsBoxItems.ContainsKey(h.Key) ? (_fieldsBoxItems[h.Key].Tag as DDField) : null;
                    var ditem = messageDetailsList.Items.Add(h.Key.ToString());
                    if (ddf != null)
                    {
                        ditem.SubItems.Add(ddf.Name).ForeColor = Color.FromArgb(255, 22, 160, 133);
                    }
                    else
                    {
                        ditem.SubItems.Add(h.Key.ToString()).ForeColor = Color.FromArgb(255, 22, 160, 133);
                    }
                    ditem.SubItems.Add(h.Value.ToString()).ForeColor = Color.FromArgb(255, 22, 160, 133);
                    if (ddf != null)
                    {
                        ditem.SubItems.Add(ddf.FixFldType).ForeColor = Color.FromArgb(255, 22, 160, 133);
                    }
                    else
                    {
                        ditem.SubItems.Add("DEFAULT").ForeColor = Color.FromArgb(255, 22, 160, 133);
                    }

                    ditem.ForeColor = Color.FromArgb(255, 22, 160, 133);
                }
                foreach (var h in message)
                {
                    var ddf   = _fieldsBoxItems.ContainsKey(h.Key) ? (_fieldsBoxItems[h.Key].Tag as DDField) : null;
                    var ditem = messageDetailsList.Items.Add(h.Key.ToString());
                    if (ddf != null)
                    {
                        ditem.SubItems.Add(ddf.Name).ForeColor = Color.FromArgb(255, 192, 57, 43);
                    }
                    else
                    {
                        ditem.SubItems.Add(h.Key.ToString()).ForeColor = Color.FromArgb(255, 192, 57, 43);
                    }
                    ditem.SubItems.Add(h.Value.ToString()).ForeColor = Color.FromArgb(255, 192, 57, 43);
                    if (ddf != null)
                    {
                        ditem.SubItems.Add(ddf.FixFldType).ForeColor = Color.FromArgb(255, 192, 57, 43);
                    }
                    else
                    {
                        ditem.SubItems.Add("DEFAULT").ForeColor = Color.FromArgb(255, 192, 57, 43);
                    }

                    ditem.ForeColor = Color.FromArgb(255, 192, 57, 43);
                }
                foreach (var h in message.Trailer)
                {
                    var ddf   = _fieldsBoxItems.ContainsKey(h.Key) ? (_fieldsBoxItems[h.Key].Tag as DDField) : null;
                    var ditem = messageDetailsList.Items.Add(h.Key.ToString());
                    if (ddf != null)
                    {
                        ditem.SubItems.Add(ddf.Name).ForeColor = Color.FromArgb(255, 25, 42, 86);
                    }
                    else
                    {
                        ditem.SubItems.Add(h.Key.ToString()).ForeColor = Color.FromArgb(255, 25, 42, 86);
                    }
                    ditem.SubItems.Add(h.Value.ToString()).ForeColor = Color.FromArgb(255, 25, 42, 86);
                    if (ddf != null)
                    {
                        ditem.SubItems.Add(ddf.FixFldType).ForeColor = Color.FromArgb(255, 25, 42, 86);
                    }
                    else
                    {
                        ditem.SubItems.Add("DEFAULT").ForeColor = Color.FromArgb(255, 25, 42, 86);
                    }

                    ditem.ForeColor = Color.FromArgb(255, 25, 42, 86);
                }
                if (entry != null)
                {
                    rawMessage.Text = entry.Content;
                }
                else
                {
                    rawMessage.Text = message.ToString();
                }
            }
        }
Beispiel #21
0
    public void FromApp(QuickFix.Message msg, SessionID sessionID)
    {
        var sMsg = "FROM APP: " + msg.ToString();

        AddToLB(sMsg, null);
        if (msg.Header.GetField(35) == "TC")     //Cash
        {
            DateTime dtTdate;
            float    fPrice;
            int      Qty;
            int      OrdType;
            bool     BPisBuyer;
            DateTime.TryParse(msg.GetField(CustomConstants.TDATE), out dtTdate);
            string BPSide = msg.GetField(CustomConstants.BP_SIDE);
            float.TryParse(msg.GetField(CustomConstants.F_PRICE), out fPrice);
            int.TryParse(msg.GetField(CustomConstants.QTY), out Qty);
            string TCTReference = msg.GetField(CustomConstants.TCT_REF);
            string BPAcct       = msg.GetField(CustomConstants.BP_COMPANY);
            int.TryParse(msg.GetField(CustomConstants.ORDER_TYPE), out OrdType);
            string ExecBkr      = msg.GetField(CustomConstants.EXEC_BKR);
            string CounterParty = msg.GetField(CustomConstants.COUNTER_PARTY);
            BPisBuyer = msg.GetField(CustomConstants.IS_BUYER) == "Y";
            string BPTrader      = msg.GetField(CustomConstants.BP_TRADER);
            string CounterTrader = msg.GetField(CustomConstants.COUNTER_TRADER);
            string Grade         = msg.GetField(CustomConstants.GRADE);
            string Location      = msg.GetField(CustomConstants.LOCATION);
            string CycDt         = msg.GetField(CustomConstants.CYCLE_DATE);
            string DelMo         = msg.GetField(CustomConstants.DELIVER_MONTH);
            string Terms         = msg.GetField(CustomConstants.TERMS);
            string Payment       = msg.GetField(CustomConstants.PAYMENT);
            string Origin        = msg.GetField(CustomConstants.ORIGIN);
            string NumOfCyc      = msg.GetField(CustomConstants.NUM_OF_CYCLES);
            string Via           = msg.GetField(CustomConstants.VIA);
            string MoveMo        = msg.GetField(CustomConstants.MOVE_MONTH);
            string Comment       = msg.GetField(CustomConstants.COMMENT);
        }
        else if (msg.Header.GetField(35) == "TE")     //EFP
        {
            DateTime dtTdate;
            float    fPrice;
            int      Qty;
            int      OrdType;
            bool     BPisBuyer;
            bool     IsWater;
            DateTime.TryParse(msg.GetField(CustomConstants.TDATE), out dtTdate);
            string BPSide = msg.GetField(CustomConstants.BP_SIDE);
            float.TryParse(msg.GetField(CustomConstants.F_PRICE), out fPrice);
            int.TryParse(msg.GetField(CustomConstants.QTY), out Qty);
            string TCTReference = msg.GetField(CustomConstants.TCT_REF);
            string BPAcct       = msg.GetField(CustomConstants.BP_COMPANY);
            int.TryParse(msg.GetField(CustomConstants.ORDER_TYPE), out OrdType);
            string ExecBkr      = msg.GetField(CustomConstants.EXEC_BKR);
            string CounterParty = msg.GetField(CustomConstants.COUNTER_PARTY);
            BPisBuyer = msg.GetField(CustomConstants.IS_BUYER) == "Y";
            string BPTrader      = msg.GetField(CustomConstants.BP_TRADER);
            string CounterTrader = msg.GetField(CustomConstants.COUNTER_TRADER);
            string Grade         = msg.GetField(CustomConstants.GRADE);
            string Location      = msg.GetField(CustomConstants.LOCATION);
            string CycDt         = msg.GetField(CustomConstants.CYCLE_DATE);
            string DelMo         = msg.GetField(CustomConstants.DELIVER_MONTH);
            string Terms         = msg.GetField(CustomConstants.TERMS);
            string Payment       = msg.GetField(CustomConstants.PAYMENT);
            string Origin        = msg.GetField(CustomConstants.ORIGIN);
            string NumOfCyc      = msg.GetField(CustomConstants.NUM_OF_CYCLES);
            string Via           = msg.GetField(CustomConstants.VIA);
            string MoveMo        = msg.GetField(CustomConstants.MOVE_MONTH);
            string Comment       = msg.GetField(CustomConstants.COMMENT);
            IsWater = msg.GetField(CustomConstants.ISWATER) == "Y";
            string BPFloorBkr      = msg.GetField(CustomConstants.BP_FLOOR_BKR);
            string CounterFloorBkr = msg.GetField(CustomConstants.COUNTER_FLOOR_BKR);
            string Diff            = msg.GetField(CustomConstants.DIFFERENCE);
            string MercMo          = msg.GetField(CustomConstants.MERC_MO);
            string MercPr          = msg.GetField(CustomConstants.MERC_PRICE);
        }
        else if (msg.Header.GetField(35) == "TI")     //Index
        {
            DateTime dtTdate;
            float    fPrice;
            int      Qty;
            int      OrdType;
            bool     BPisBuyer;
            bool     IsWater;
            DateTime.TryParse(msg.GetField(CustomConstants.TDATE), out dtTdate);
            string BPSide = msg.GetField(CustomConstants.BP_SIDE);
            float.TryParse(msg.GetField(CustomConstants.F_PRICE), out fPrice);
            int.TryParse(msg.GetField(CustomConstants.QTY), out Qty);
            string TCTReference = msg.GetField(CustomConstants.TCT_REF);
            string BPAcct       = msg.GetField(CustomConstants.BP_COMPANY);
            int.TryParse(msg.GetField(CustomConstants.ORDER_TYPE), out OrdType);
            string ExecBkr      = msg.GetField(CustomConstants.EXEC_BKR);
            string CounterParty = msg.GetField(CustomConstants.COUNTER_PARTY);
            BPisBuyer = msg.GetField(CustomConstants.IS_BUYER) == "Y";
            string BPTrader      = msg.GetField(CustomConstants.BP_TRADER);
            string CounterTrader = msg.GetField(CustomConstants.COUNTER_TRADER);
            string Grade         = msg.GetField(CustomConstants.GRADE);
            string Location      = msg.GetField(CustomConstants.LOCATION);
            string CycDt         = msg.GetField(CustomConstants.CYCLE_DATE);
            string DelMo         = msg.GetField(CustomConstants.DELIVER_MONTH);
            string Terms         = msg.GetField(CustomConstants.TERMS);
            string Payment       = msg.GetField(CustomConstants.PAYMENT);
            string Origin        = msg.GetField(CustomConstants.ORIGIN);
            string NumOfCyc      = msg.GetField(CustomConstants.NUM_OF_CYCLES);
            string Via           = msg.GetField(CustomConstants.VIA);
            string MoveMo        = msg.GetField(CustomConstants.MOVE_MONTH);
            string Comment       = msg.GetField(CustomConstants.COMMENT);
            IsWater = msg.GetField(CustomConstants.ISWATER) == "Y";
            string BPFloorBkr      = msg.GetField(CustomConstants.BP_FLOOR_BKR);
            string CounterFloorBkr = msg.GetField(CustomConstants.COUNTER_FLOOR_BKR);
            string Diff            = msg.GetField(CustomConstants.DIFFERENCE);
            string MercMo          = msg.GetField(CustomConstants.MERC_MO);
            string MercPr          = msg.GetField(CustomConstants.MERC_PRICE);
        }
    }