public InterestAccrualsCompoundingMethod(XmlNode xmlNode) : base(xmlNode) { XmlNodeList compoundingMethodNodeList = xmlNode.SelectNodes("compoundingMethod"); if (compoundingMethodNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingMethodNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingMethodIDRef = item.Attributes["id"].Name; CompoundingMethodEnum ob = CompoundingMethodEnum(); IDManager.SetID(compoundingMethodIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingMethodIDRef = item.Attributes["href"].Name; } else { compoundingMethod = new CompoundingMethodEnum(item); } } } }
public static Calculation CreateFixed(decimal fixedRate, decimal discountRate, Money notional, CompoundingMethodEnum compoundingMethod, DayCountFraction dayCountFraction, DiscountingTypeEnum discountingType) { var calculation = new Calculation { Item = NotionalFactory.Create(notional), compoundingMethod = compoundingMethod, compoundingMethodSpecified = true, dayCountFraction = dayCountFraction, discounting = DiscountingHelper.Create(discountRate, dayCountFraction, discountingType), Items = new object[] { FixedRateScheduleHelper.Create(fixedRate) } }; return(calculation); }
public Calculation(XmlNode xmlNode) { XmlNodeList notionalScheduleNodeList = xmlNode.SelectNodes("notionalSchedule"); if (notionalScheduleNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in notionalScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { notionalScheduleIDRef = item.Attributes["id"].Name; Notional ob = Notional(); IDManager.SetID(notionalScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { notionalScheduleIDRef = item.Attributes["href"].Name; } else { notionalSchedule = new Notional(item); } } } XmlNodeList fxLinkedNotionalScheduleNodeList = xmlNode.SelectNodes("fxLinkedNotionalSchedule"); if (fxLinkedNotionalScheduleNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in fxLinkedNotionalScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fxLinkedNotionalScheduleIDRef = item.Attributes["id"].Name; FxLinkedNotionalSchedule ob = FxLinkedNotionalSchedule(); IDManager.SetID(fxLinkedNotionalScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { fxLinkedNotionalScheduleIDRef = item.Attributes["href"].Name; } else { fxLinkedNotionalSchedule = new FxLinkedNotionalSchedule(item); } } } XmlNodeList fixedRateScheduleNodeList = xmlNode.SelectNodes("fixedRateSchedule"); if (fixedRateScheduleNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in fixedRateScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fixedRateScheduleIDRef = item.Attributes["id"].Name; Schedule ob = Schedule(); IDManager.SetID(fixedRateScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { fixedRateScheduleIDRef = item.Attributes["href"].Name; } else { fixedRateSchedule = new Schedule(item); } } } XmlNodeList futureValueNotionalNodeList = xmlNode.SelectNodes("futureValueNotional"); if (futureValueNotionalNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in futureValueNotionalNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { futureValueNotionalIDRef = item.Attributes["id"].Name; FutureValueAmount ob = FutureValueAmount(); IDManager.SetID(futureValueNotionalIDRef, ob); } else if (item.Attributes.ToString() == "href") { futureValueNotionalIDRef = item.Attributes["href"].Name; } else { futureValueNotional = new FutureValueAmount(item); } } } XmlNodeList rateCalculationNodeList = xmlNode.SelectNodes("rateCalculation"); if (rateCalculationNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in rateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { rateCalculationIDRef = item.Attributes["id"].Name; Rate ob = Rate(); IDManager.SetID(rateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { rateCalculationIDRef = item.Attributes["href"].Name; } else { rateCalculation = new Rate(item); } } } XmlNodeList floatingRateCalculationNodeList = xmlNode.SelectNodes("floatingRateCalculation"); if (floatingRateCalculationNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in floatingRateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { floatingRateCalculationIDRef = item.Attributes["id"].Name; FloatingRateCalculation ob = FloatingRateCalculation(); IDManager.SetID(floatingRateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { floatingRateCalculationIDRef = item.Attributes["href"].Name; } else { floatingRateCalculation = new FloatingRateCalculation(item); } } } XmlNodeList inflationRateCalculationNodeList = xmlNode.SelectNodes("inflationRateCalculation"); if (inflationRateCalculationNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in inflationRateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { inflationRateCalculationIDRef = item.Attributes["id"].Name; InflationRateCalculation ob = InflationRateCalculation(); IDManager.SetID(inflationRateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { inflationRateCalculationIDRef = item.Attributes["href"].Name; } else { inflationRateCalculation = new InflationRateCalculation(item); } } } XmlNodeList dayCountFractionNodeList = xmlNode.SelectNodes("dayCountFraction"); if (dayCountFractionNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in dayCountFractionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { dayCountFractionIDRef = item.Attributes["id"].Name; DayCountFraction ob = DayCountFraction(); IDManager.SetID(dayCountFractionIDRef, ob); } else if (item.Attributes.ToString() == "href") { dayCountFractionIDRef = item.Attributes["href"].Name; } else { dayCountFraction = new DayCountFraction(item); } } } XmlNodeList discountingNodeList = xmlNode.SelectNodes("discounting"); if (discountingNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in discountingNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { discountingIDRef = item.Attributes["id"].Name; Discounting ob = Discounting(); IDManager.SetID(discountingIDRef, ob); } else if (item.Attributes.ToString() == "href") { discountingIDRef = item.Attributes["href"].Name; } else { discounting = new Discounting(item); } } } XmlNodeList compoundingMethodNodeList = xmlNode.SelectNodes("compoundingMethod"); if (compoundingMethodNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingMethodNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingMethodIDRef = item.Attributes["id"].Name; CompoundingMethodEnum ob = CompoundingMethodEnum(); IDManager.SetID(compoundingMethodIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingMethodIDRef = item.Attributes["href"].Name; } else { compoundingMethod = new CompoundingMethodEnum(item); } } } }
public Compounding(XmlNode xmlNode) { XmlNodeList compoundingMethodNodeList = xmlNode.SelectNodes("compoundingMethod"); if (compoundingMethodNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingMethodNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingMethodIDRef = item.Attributes["id"].Name; CompoundingMethodEnum ob = CompoundingMethodEnum(); IDManager.SetID(compoundingMethodIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingMethodIDRef = item.Attributes["href"].Name; } else { compoundingMethod = new CompoundingMethodEnum(item); } } } XmlNodeList compoundingRateNodeList = xmlNode.SelectNodes("compoundingRate"); if (compoundingRateNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingRateNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingRateIDRef = item.Attributes["id"].Name; CompoundingRate ob = CompoundingRate(); IDManager.SetID(compoundingRateIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingRateIDRef = item.Attributes["href"].Name; } else { compoundingRate = new CompoundingRate(item); } } } XmlNodeList compoundingSpreadNodeList = xmlNode.SelectNodes("compoundingSpread"); if (compoundingSpreadNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingSpreadNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingSpreadIDRef = item.Attributes["id"].Name; XsdTypeDecimal ob = XsdTypeDecimal(); IDManager.SetID(compoundingSpreadIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingSpreadIDRef = item.Attributes["href"].Name; } else { compoundingSpread = new XsdTypeDecimal(item); } } } XmlNodeList compoundingDatesNodeList = xmlNode.SelectNodes("compoundingDates"); if (compoundingDatesNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingDatesNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingDatesIDRef = item.Attributes["id"].Name; AdjustableRelativeOrPeriodicDates2 ob = AdjustableRelativeOrPeriodicDates2(); IDManager.SetID(compoundingDatesIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingDatesIDRef = item.Attributes["href"].Name; } else { compoundingDates = new AdjustableRelativeOrPeriodicDates2(item); } } } }