コード例 #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));
        }