Beispiel #1
0
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 23 + FactorID.GetHashCode();
            hash = hash * 23 + DatasetID.GetHashCode();

            return(hash);
        }
Beispiel #2
0
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 23 + FactorID.GetHashCode();
            hash = hash * 23 + Name.GetHashCode();
            hash = hash * 23 + Value.GetHashCode();

            return(hash);
        }
Beispiel #3
0
        /// <summary>
        /// Validate deal properties.
        /// </summary>
        public override void Validate(ICalendarData calendar, ErrorList errors)
        {
            base.Validate(calendar, errors);

            if (string.IsNullOrEmpty(Reference_Type))
            {
                AddToErrors(errors, "An invalid or no reference type has been provided.");
            }

            if (Contract_Size <= 0)
            {
                AddToErrors(errors, "The contract size must be positive.");
            }

            if (Units <= 0)
            {
                AddToErrors(errors, "The number of units must be positive.");
            }

            if (Realized_Average_1 < 0 || Realized_Average_2 < 0)
            {
                AddToErrors(errors, "Realized averages must be positive.");
            }

            if (Settlement_Date < Period_End_1)
            {
                errors.Add(ErrorLevel.Error, "Settlement date must lie on or after period end: " + Period_End_1);
            }

            if (Period_End_1 >= Period_End_2)
            {
                errors.Add(ErrorLevel.Error, "End of sampling period 2 must be after end of sampling period 1." + Period_End_2);
            }

            if (Period_End_1 < Period_Start_1)
            {
                errors.Add(ErrorLevel.Error, "Period end date must lie on or after period start: " + Period_Start_1);
            }

            if (Period_End_2 < Period_Start_2)
            {
                errors.Add(ErrorLevel.Error, "Period end date must lie on or after period start: " + Period_Start_2);
            }

            // Check that the reference price does not have a parent, e.g. SPREAD.GAS
            var dummyFactorID = new FactorID(Reference_Type);

            if (dummyFactorID.Count > 1)
            {
                errors.Add(ErrorLevel.Error, string.Format("Calendar Spread Option valid only on contracts with one suffix, e.g., ForwardPrice.GAS and not on ForwardPrice.{0}",
                                                           Reference_Type));
            }
        }
Beispiel #4
0
 /// <summary>
 /// Serves as a hash function for a particular type. GetHashCode() is suitable
 /// for use in hashing algorithms and data structures like a hash table.
 /// </summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     return(FactorID.GetHashCode());
 }
Beispiel #5
0
 ///<summary>
 /// Returns a String that represents the current object.
 ///</summary>
 public override string ToString()
 {
     return("NarrativeFactorID:" + FactorID.ToString());
 }