Exemplo n.º 1
0
        /// <summary>
        /// Validate deal properties.
        /// </summary>
        public override void Validate(ICalendarData calendar, ErrorList errors)
        {
            InitialiseHolidayCalendars(calendar);
            var parameters = new CashflowListDateGenerationParameters
            {
                AccrualCalendar      = AccrualHolidayCalendar(),
                RateCalendar         = RateHolidayCalendar(),
                RateOffset           = Rate_Offset,
                RateAdjustmentMethod = Rate_Adjustment_Method,
                RateStickyMonthEnd   = Rate_Sticky_Month_End
            };

            if (fCashflows.FinishBuild(parameters))
            {
                AddToErrors(errors, ErrorLevel.Info, "Missing cashflow properties have been calculated (Accrual_Year_Fraction, Rate_Start_Date, Rate_End_Date, Rate_Year_Fraction)");
            }

            base.Validate(calendar, errors);

            if (Settlement_Style == SettlementType.Cash && Settlement_Date == 0.0)
            {
                AddToErrors(errors, "Settlement_Date must be specified when Settlement_Style is Cash");
            }

            if (Settlement_Amount != 0.0 && Settlement_Date == 0.0)
            {
                AddToErrors(errors, ErrorLevel.Warning, "Settlement_Amount is not zero but Settlement_Date is not specified so Settlement_Amount has been ignored.");
            }

            if (fCashflows.Items.Any(cashflow => cashflow.Payment_Date <= Settlement_Date))
            {
                AddToErrors(errors, "Cashflows must have Payment_Date after Settlement_Date");
            }

            if (fCashflows.Items.Any(cashflow => cashflow.FX_Reset_Date > 0.0 || cashflow.Known_FX_Rate > 0.0))
            {
                // Do not support forward deals on cashflow lists with FX_Reset_Date or Known_FX_Rate
                if (Settlement_Date > 0.0)
                {
                    AddToErrors(errors, "Cashflow list deal with Settlement_Date cannot have cashflows with FX_Reset_Date or Known_FX_Rate");
                }

                // Do not support cashflow lists with FX_Reset_Date or Known_FX_Rate under Use_Survival_Probability or Respect_Default
                if (!string.IsNullOrEmpty(Issuer))
                {
                    AddToErrors(errors, "Cashflow list deal with Issuer cannot have cashflows with FX_Reset_Date or Known_FX_Rate");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Validates the specified errors.
        /// </summary>
        public override void Validate(ICalendarData calendar, ErrorList errors)
        {
            InitialiseHolidayCalendars(calendar);
            var parameters = new CashflowListDateGenerationParameters()
            {
                AccrualDayCount      = Accrual_Day_Count,
                AccrualCalendar      = AccrualHolidayCalendar(),
                RateDayCount         = Rate_Day_Count,
                RateCalendar         = RateHolidayCalendar(),
                RateOffset           = Rate_Offset,
                RateAdjustmentMethod = Rate_Adjustment_Method,
                RateStickyMonthEnd   = Rate_Sticky_Month_End,
            };

            if (fCashflows.FinishBuild(parameters))
            {
                AddToErrors(errors, ErrorLevel.Info, "Missing cashflow properties have been calculated (Accrual_Year_Fraction, Rate_Start_Date, Rate_End_Date, Rate_Year_Fraction)");
            }

            base.Validate(calendar, errors);

            if (string.IsNullOrWhiteSpace(Equity))
            {
                AddToErrors(errors, "Equity must be specified on the deal.");
            }

            if (string.IsNullOrWhiteSpace(Equity_Currency))
            {
                AddToErrors(errors, "Equity_Currency must be specified on the deal.");
            }

            bool equityPayoffInAssetCurrency = string.IsNullOrEmpty(Equity_Payoff_Currency) || Equity_Payoff_Currency == Equity_Currency;

            if (!equityPayoffInAssetCurrency && Equity_Payoff_Type == PayoffType.Standard)
            {
                AddToErrors(errors, ErrorLevel.Error, "Equity_Payoff_Type cannot be Standard when Equity_Payoff_Currency and Equity_Currency are different");
            }
            else if (equityPayoffInAssetCurrency && Equity_Payoff_Type != PayoffType.Standard)
            {
                AddToErrors(errors, ErrorLevel.Info, "Payoff_Currency and Currency are the same but Payoff_Type is not Standard");
            }

            fCashflows.ValidateQuantoCompo(GetEquityPayoffType(), IsCrossCurrency(), errors);
        }
        /// <summary>
        /// Validate deal properties.
        /// </summary>
        public override void Validate(ICalendarData calendar, ErrorList errors)
        {
            InitialiseHolidayCalendars(calendar);
            var parameters = new CashflowListDateGenerationParameters()
            {
                AccrualCalendar      = AccrualHolidayCalendar(),
                RateCalendar         = Rate1HolidayCalendar(),
                Rate1Calendar        = Rate1HolidayCalendar(),
                Rate2Calendar        = Rate2HolidayCalendar(),
                RateOffset           = Rate_Offset,
                RateAdjustmentMethod = Rate_Adjustment_Method,
                RateStickyMonthEnd   = Rate_Sticky_Month_End,
            };

            if (fCashflows.FinishBuild(parameters))
            {
                AddToErrors(errors, ErrorLevel.Info, "Missing cashflow properties have been calculated (Accrual_Year_Fraction, Rate_Start_Date, Rate1_End_Date, Rate1_Year_Fraction, Rate2_End_Date, Rate2_Year_Fraction)");
            }

            base.Validate(calendar, errors);
        }