コード例 #1
0
        /// <summary>
        /// Validate deal properties.
        /// </summary>
        public override void Validate(ICalendarData calendar, ErrorList errors)
        {
            base.Validate(calendar, errors);

            if (Notional < CalcUtils.MinAssetPrice)
            {
                AddToErrors(errors, string.Format("Bond Notional must be at least {0}", CalcUtils.MinAssetPrice));
            }

            CalcUtils.ValidateDates(errors, Issue_Date, Bond_Maturity_Date, First_Coupon_Date, Penultimate_Coupon_Date, false, "Issue", "bond maturity");

            Coupon_Rate_Schedule.Validate(errors, false, "Fixed rate schedule");
            Amortisation.Validate(errors);

            CalcUtils.ValidateDates(errors, Issue_Date, Bond_Maturity_Date, true, "Issue", "bond maturity");

            if (Settlement_Date != 0.0)
            {
                CalcUtils.ValidateDates(errors, Settlement_Date, Bond_Maturity_Date, true, "Settlement", "bond maturity");
            }

            CalcUtils.ValidateDates(errors, First_Call_Date, Last_Call_Date, false, "First call", "last call");

            Call_Prices.Validate(errors, true, "Call prices");

            if (IsForward())
            {
                if (Settlement_Date == 0.0)
                {
                    AddToErrors(errors, "Settlement_Date must be specified");
                }

                if (Price == 0.0)
                {
                    AddToErrors(errors, ErrorLevel.Info, "Settlement price (Price) is zero.");
                }
            }
            else
            {
                if (Price != 0.0 && Settlement_Date == 0.0)
                {
                    AddToErrors(errors, ErrorLevel.Warning, "Settlement price (Price) is not zero but Settlement_Date is not specified so Price has been ignored.");
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Validate deal properties.
        /// </summary>
        public override void Validate(ICalendarData calendar, ErrorList errors)
        {
            base.Validate(calendar, errors);

            CalcUtils.ValidateDates(errors, Issue_Date, Bond_Maturity_Date, First_Coupon_Date, Penultimate_Coupon_Date, true, "issue", "bond maturity");

            if (Coupon_Interval <= 0.0)
            {
                AddToErrors(errors, "Coupon interval must be greater than zero");
            }

            if (Expiry_Date >= Bond_Maturity_Date)
            {
                AddToErrors(errors, "Expiry date must lie before bond maturity date: " + Bond_Maturity_Date.ToString());
            }

            if (Strike_Price <= 0.0)
            {
                AddToErrors(errors, "Strike price must be positive");
            }

            Amortisation.Validate(errors);
        }