Ejemplo n.º 1
0
        public void ReverseRoute(Header header)
        {
            // required routing tags
            this.Header.RemoveField(Tags.BeginString);
            this.Header.RemoveField(Tags.SenderCompID);
            this.Header.RemoveField(Tags.SenderSubID);
            this.Header.RemoveField(Tags.SenderLocationID);
            this.Header.RemoveField(Tags.TargetCompID);
            this.Header.RemoveField(Tags.TargetSubID);
            this.Header.RemoveField(Tags.TargetLocationID);

            if (header.IsSetField(Tags.BeginString))
            {
                string beginString = header.GetField(Tags.BeginString);
                if (beginString.Length > 0)
                {
                    this.Header.SetField(new BeginString(beginString));
                }

                this.Header.RemoveField(Tags.OnBehalfOfLocationID);
                this.Header.RemoveField(Tags.DeliverToLocationID);

                if (beginString.CompareTo("FIX.4.1") >= 0)
                {
                    if (header.IsSetField(Tags.OnBehalfOfLocationID))
                    {
                        string onBehalfOfLocationID = header.GetField(Tags.OnBehalfOfLocationID);
                        if (onBehalfOfLocationID.Length > 0)
                        {
                            this.Header.SetField(new DeliverToLocationID(onBehalfOfLocationID));
                        }
                    }

                    if (header.IsSetField(Tags.DeliverToLocationID))
                    {
                        string deliverToLocationID = header.GetField(Tags.DeliverToLocationID);
                        if (deliverToLocationID.Length > 0)
                        {
                            this.Header.SetField(new OnBehalfOfLocationID(deliverToLocationID));
                        }
                    }
                }
            }

            if (header.IsSetField(Tags.SenderCompID))
            {
                SenderCompID senderCompID = new SenderCompID();
                header.GetField(senderCompID);
                if (senderCompID.Obj.Length > 0)
                {
                    this.Header.SetField(new TargetCompID(senderCompID.Obj));
                }
            }

            if (header.IsSetField(Tags.SenderSubID))
            {
                SenderSubID senderSubID = new SenderSubID();
                header.GetField(senderSubID);
                if (senderSubID.Obj.Length > 0)
                {
                    this.Header.SetField(new TargetSubID(senderSubID.Obj));
                }
            }

            if (header.IsSetField(Tags.SenderLocationID))
            {
                SenderLocationID senderLocationID = new SenderLocationID();
                header.GetField(senderLocationID);
                if (senderLocationID.Obj.Length > 0)
                {
                    this.Header.SetField(new TargetLocationID(senderLocationID.Obj));
                }
            }

            if (header.IsSetField(Tags.TargetCompID))
            {
                TargetCompID targetCompID = new TargetCompID();
                header.GetField(targetCompID);
                if (targetCompID.Obj.Length > 0)
                {
                    this.Header.SetField(new SenderCompID(targetCompID.Obj));
                }
            }

            if (header.IsSetField(Tags.TargetSubID))
            {
                TargetSubID targetSubID = new TargetSubID();
                header.GetField(targetSubID);
                if (targetSubID.Obj.Length > 0)
                {
                    this.Header.SetField(new SenderSubID(targetSubID.Obj));
                }
            }

            if (header.IsSetField(Tags.TargetLocationID))
            {
                TargetLocationID targetLocationID = new TargetLocationID();
                header.GetField(targetLocationID);
                if (targetLocationID.Obj.Length > 0)
                {
                    this.Header.SetField(new SenderLocationID(targetLocationID.Obj));
                }
            }

            // optional routing tags
            this.Header.RemoveField(Tags.OnBehalfOfCompID);
            this.Header.RemoveField(Tags.OnBehalfOfSubID);
            this.Header.RemoveField(Tags.DeliverToCompID);
            this.Header.RemoveField(Tags.DeliverToSubID);

            if (header.IsSetField(Tags.OnBehalfOfCompID))
            {
                string onBehalfOfCompID = header.GetField(Tags.OnBehalfOfCompID);
                if (onBehalfOfCompID.Length > 0)
                {
                    this.Header.SetField(new DeliverToCompID(onBehalfOfCompID));
                }
            }

            if (header.IsSetField(Tags.OnBehalfOfSubID))
            {
                string onBehalfOfSubID = header.GetField(Tags.OnBehalfOfSubID);
                if (onBehalfOfSubID.Length > 0)
                {
                    this.Header.SetField(new DeliverToSubID(onBehalfOfSubID));
                }
            }

            if (header.IsSetField(Tags.DeliverToCompID))
            {
                string deliverToCompID = header.GetField(Tags.DeliverToCompID);
                if (deliverToCompID.Length > 0)
                {
                    this.Header.SetField(new OnBehalfOfCompID(deliverToCompID));
                }
            }

            if (header.IsSetField(Tags.DeliverToSubID))
            {
                string deliverToSubID = header.GetField(Tags.DeliverToSubID);
                if (deliverToSubID.Length > 0)
                {
                    this.Header.SetField(new OnBehalfOfSubID(deliverToSubID));
                }
            }
        }
Ejemplo n.º 2
0
        public void ReverseRoute(Header header)
        {
            // required routing tags
            this.Header.RemoveField(Tags.BeginString);
            this.Header.RemoveField(Tags.SenderCompID);
            this.Header.RemoveField(Tags.SenderSubID);
            this.Header.RemoveField(Tags.SenderLocationID);
            this.Header.RemoveField(Tags.TargetCompID);
            this.Header.RemoveField(Tags.TargetSubID);
            this.Header.RemoveField(Tags.TargetLocationID);

            if (header.IsSetField(Tags.BeginString))
            {
                string beginString = header.GetField(Tags.BeginString);
                if (beginString.Length > 0)
                {
                    this.Header.SetField(new BeginString(beginString));
                }

                this.Header.RemoveField(Tags.OnBehalfOfLocationID);
                this.Header.RemoveField(Tags.DeliverToLocationID);

                if (beginString.CompareTo("FIX.4.1") >= 0)
                {
                    if (header.IsSetField(Tags.OnBehalfOfLocationID))
                    {
                        string onBehalfOfLocationID = header.GetField(Tags.OnBehalfOfLocationID);
                        if (onBehalfOfLocationID.Length > 0)
                        {
                            this.Header.SetField(new DeliverToLocationID(onBehalfOfLocationID));
                        }
                    }

                    if (header.IsSetField(Tags.DeliverToLocationID))
                    {
                        string deliverToLocationID = header.GetField(Tags.DeliverToLocationID);
                        if (deliverToLocationID.Length > 0)
                        {
                            this.Header.SetField(new OnBehalfOfLocationID(deliverToLocationID));
                        }
                    }
                }
            }

            if (header.IsSetField(Tags.SenderCompID))
            {
                SenderCompID senderCompID = new SenderCompID();
                header.GetField(senderCompID);
                if (senderCompID.Obj.Length > 0)
                {
                    this.Header.SetField(new TargetCompID(senderCompID.Obj));
                }
            }

            if (header.IsSetField(Tags.SenderSubID))
            {
                SenderSubID senderSubID = new SenderSubID();
                header.GetField(senderSubID);
                if (senderSubID.Obj.Length > 0)
                {
                    this.Header.SetField(new TargetSubID(senderSubID.Obj));
                }
            }

            if (header.IsSetField(Tags.SenderLocationID))
            {
                SenderLocationID senderLocationID = new SenderLocationID();
                header.GetField(senderLocationID);
                if (senderLocationID.Obj.Length > 0)
                {
                    this.Header.SetField(new TargetLocationID(senderLocationID.Obj));
                }
            }

            if (header.IsSetField(Tags.TargetCompID))
            {
                TargetCompID targetCompID = new TargetCompID();
                header.GetField(targetCompID);
                if (targetCompID.Obj.Length > 0)
                {
                    this.Header.SetField(new SenderCompID(targetCompID.Obj));
                }
            }

            if (header.IsSetField(Tags.TargetSubID))
            {
                TargetSubID targetSubID = new TargetSubID();
                header.GetField(targetSubID);
                if (targetSubID.Obj.Length > 0)
                {
                    this.Header.SetField(new SenderSubID(targetSubID.Obj));
                }
            }

            if (header.IsSetField(Tags.TargetLocationID))
            {
                TargetLocationID targetLocationID = new TargetLocationID();
                header.GetField(targetLocationID);
                if (targetLocationID.Obj.Length > 0)
                {
                    this.Header.SetField(new SenderLocationID(targetLocationID.Obj));
                }
            }

            // optional routing tags
            this.Header.RemoveField(Tags.OnBehalfOfCompID);
            this.Header.RemoveField(Tags.OnBehalfOfSubID);
            this.Header.RemoveField(Tags.DeliverToCompID);
            this.Header.RemoveField(Tags.DeliverToSubID);

            if (header.IsSetField(Tags.OnBehalfOfCompID))
            {
                string onBehalfOfCompID = header.GetField(Tags.OnBehalfOfCompID);
                if (onBehalfOfCompID.Length > 0)
                {
                    this.Header.SetField(new DeliverToCompID(onBehalfOfCompID));
                }
            }

            if (header.IsSetField(Tags.OnBehalfOfSubID))
            {
                string onBehalfOfSubID = header.GetField(Tags.OnBehalfOfSubID);
                if (onBehalfOfSubID.Length > 0)
                {
                    this.Header.SetField(new DeliverToSubID(onBehalfOfSubID));
                }
            }

            // A.Chisholm 19-01-2017
            // As we're a hub we want to reject from ourselves and not OBO the inbound DeliverToCompID
            //if(header.IsSetField(Tags.DeliverToCompID))
            //{
            //    string deliverToCompID = header.GetField(Tags.DeliverToCompID);
            //    if(deliverToCompID.Length > 0)
            //        this.Header.SetField(new OnBehalfOfCompID(deliverToCompID));
            //}

            if (header.IsSetField(Tags.DeliverToSubID))
            {
                string deliverToSubID = header.GetField(Tags.DeliverToSubID);
                if (deliverToSubID.Length > 0)
                {
                    this.Header.SetField(new OnBehalfOfSubID(deliverToSubID));
                }
            }
        }