public List <String> GetRequiredCurrencies()
        {
            var result = new List <string>();
            var item   = XsdClassesFieldResolver.CalculationGetNotionalSchedule((Calculation)calculationPeriodAmount.Item);

            if (item != null && item.notionalStepSchedule != null && item.notionalStepSchedule.currency != null)
            {
                result.Add(item.notionalStepSchedule.currency.Value);
            }
            return(result);
        }
Esempio n. 2
0
        ///<summary>
        /// Gets all the Forecast curve name.
        ///</summary>
        ///<returns></returns>
        public static string GetRateVolatilityMatrixName(Swap swap)
        {
            AdjustableDate adjustableEffectiveDate   = XsdClassesFieldResolver.CalculationPeriodDatesGetEffectiveDate(swap.swapStream[0].calculationPeriodDates);
            AdjustableDate adjustableTerminationDate = XsdClassesFieldResolver.CalculationPeriodDatesGetTerminationDate(swap.swapStream[0].calculationPeriodDates);
            var            years       = adjustableTerminationDate.unadjustedDate.Value.Year - adjustableEffectiveDate.unadjustedDate.Value.Year;
            var            calculation = (Calculation)swap.swapStream[0].calculationPeriodAmount.Item;
            var            notional    = XsdClassesFieldResolver.CalculationGetNotionalSchedule(calculation);
            var            currency    = notional.notionalStepSchedule.currency.Value;

            return("RateVolatilityMatrix." + currency + "-IRSwap-" + years + "Y");
        }
        /// <summary>
        /// Gets and sets the required pricing structures to value this leg.
        /// </summary>
        public List <String> GetRequiredPricingStructures()
        {
            var result = new List <String>();
            var amount = calculationPeriodAmount.Item as Calculation;

            if (amount != null)
            {
                var currency = XsdClassesFieldResolver.CalculationGetNotionalSchedule(amount);
                if (currency != null && currency.notionalStepSchedule != null)
                {
                    var discountCurve = Helpers.GetDiscountCurveName(currency.notionalStepSchedule.currency);
                    result.Add(discountCurve);
                }
                var floatingRateCalculation = amount.Items[0] as FloatingRateCalculation;
                if (floatingRateCalculation != null)
                {
                    result.Add(Helpers.GetForecastCurveName(floatingRateCalculation.floatingRateIndex, floatingRateCalculation.indexTenor));
                }
            }
            //TODO
            if (stubCalculationPeriodAmount != null)
            {
                if (stubCalculationPeriodAmount.Items != null)
                {
                    foreach (var item in stubCalculationPeriodAmount.Items)
                    {
                        if (item.Items != null)
                        {
                            result.AddRange(from value in item.Items
                                            where value as Money != null
                                            select Helpers.GetDiscountCurveName(((Money)value).currency));
                        }
                    }
                }
                //if (stubCalculationPeriodAmount != null)
                //{
                //    if (stubCalculationPeriodAmount.initialStub != null && stubCalculationPeriodAmount.initialStub.Items != null)
                //    {
                //        result.AddRange(from value in stubCalculationPeriodAmount.initialStub.Items
                //                            where value as Money != null
                //                            select Helpers.GetDiscountCurveName(((Money)value).currency));
                //    }
                //    if (stubCalculationPeriodAmount.finalStub != null && stubCalculationPeriodAmount.finalStub.Items != null)
                //    {
                //        result.AddRange(from value in stubCalculationPeriodAmount.finalStub.Items
                //                            where value as Money != null
                //                            select Helpers.GetDiscountCurveName(((Money)value).currency));
                //    }
            }
            return(result);
        }