// other public override void setupArguments(IPricingEngineArguments args) { base.setupArguments(args); YearOnYearInflationSwap.Arguments arguments = args as YearOnYearInflationSwap.Arguments; if (arguments == null) // it's a swap engine... { return; } arguments.type = type_; arguments.nominal = nominal_; List <CashFlow> fixedCoupons = fixedLeg(); arguments.fixedResetDates = arguments.fixedPayDates = new List <Date>(fixedCoupons.Count); arguments.fixedCoupons = new List <double>(fixedCoupons.Count); for (int i = 0; i < fixedCoupons.Count; ++i) { FixedRateCoupon coupon = fixedCoupons[i] as FixedRateCoupon; arguments.fixedPayDates.Add(coupon.date()); arguments.fixedResetDates.Add(coupon.accrualStartDate()); arguments.fixedCoupons.Add(coupon.amount()); } List <CashFlow> yoyCoupons = yoyLeg(); arguments.yoyResetDates = arguments.yoyPayDates = arguments.yoyFixingDates = new List <Date>(yoyCoupons.Count); arguments.yoyAccrualTimes = new List <double>(yoyCoupons.Count); arguments.yoySpreads = new List <double>(yoyCoupons.Count); arguments.yoyCoupons = new List <double?>(yoyCoupons.Count); for (int i = 0; i < yoyCoupons.Count; ++i) { YoYInflationCoupon coupon = yoyCoupons[i] as YoYInflationCoupon; arguments.yoyResetDates.Add(coupon.accrualStartDate()); arguments.yoyPayDates.Add(coupon.date()); arguments.yoyFixingDates.Add(coupon.fixingDate()); arguments.yoyAccrualTimes.Add(coupon.accrualPeriod()); arguments.yoySpreads.Add(coupon.spread()); try { arguments.yoyCoupons.Add(coupon.amount()); } catch (Exception) { arguments.yoyCoupons.Add(null); } } }