Esempio n. 1
0
        /// <summary>
        /// Compares this option series to another one by its attributes.
        /// Expiration takes precedence in comparison.
        /// </summary>
        /// <param name="other">another option series to compare with.</param>
        /// <returns>result of comparison.</returns>
        public int CompareTo(OptionSeries other)
        {
            if (Expiration < other.Expiration)
            {
                return(-1);
            }
            if (Expiration > other.Expiration)
            {
                return(1);
            }
            if (LastTrade < other.LastTrade)
            {
                return(-1);
            }
            if (LastTrade > other.LastTrade)
            {
                return(1);
            }
            int i = Multiplier.CompareTo(other.Multiplier);

            if (i != 0)
            {
                return(i);
            }
            i = SPC.CompareTo(other.SPC);
            if (i != 0)
            {
                return(i);
            }
            i = AdditionalUnderlyings.CompareTo(other.AdditionalUnderlyings);
            if (i != 0)
            {
                return(i);
            }
            i = MMY.CompareTo(other.MMY);
            if (i != 0)
            {
                return(i);
            }
            i = OptionType.CompareTo(other.OptionType);
            if (i != 0)
            {
                return(i);
            }
            i = ExpirationStyle.CompareTo(other.ExpirationStyle);
            if (i != 0)
            {
                return(i);
            }
            i = SettlementStyle.CompareTo(other.SettlementStyle);
            if (i != 0)
            {
                return(i);
            }
            return(CFI.CompareTo(other.CFI));
        }
Esempio n. 2
0
        /// <summary>
        /// Indicates whether some other object is equal to this option series by its attributes.
        /// </summary>
        /// <param name="o"></param>
        /// <returns>another object to compare with.</returns>
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is OptionSeries))
            {
                return(false);
            }
            OptionSeries that = (OptionSeries)o;

            return(Expiration == that.Expiration &&
                   LastTrade == that.LastTrade &&
                   Multiplier.CompareTo(that.Multiplier) == 0 &&
                   SPC.CompareTo(that.SPC) == 0 &&
                   AdditionalUnderlyings.Equals(that.AdditionalUnderlyings) &&
                   ExpirationStyle.Equals(that.ExpirationStyle) &&
                   MMY.Equals(that.MMY) &&
                   OptionType.Equals(that.OptionType) &&
                   CFI.Equals(that.CFI) &&
                   SettlementStyle.Equals(that.SettlementStyle));
        }