private static Coupon[] BuildDslCoupons(string legId, Parameters parameters, string[] dslCouponPayoffs) { var payCurrencies = parameters.GetColFromLabel(legId + "PayCurrency", o => Currency.Parse(o.ToString())); var payDates = parameters.RowLabels; var couponPayments = payDates.ZipWith(payCurrencies, (d, c) => new PaymentInfo(c, d)); var couponPayoffs = DslPayoffFactory.Build(legId + "Date", parameters, dslCouponPayoffs); return(couponPayments.ZipWith(couponPayoffs, (payInfo, payoff) => new Coupon(payInfo, payoff))); }
private IProduct BuilAutoCall(ICouponDecomposable underlying, object[,] bag) { var parameters = bag.ProcessLabelledMatrix("AutocallDate", DateAndDurationConverter.ConvertDate, o => o.ToString(), o => o); var redemptionScripts = parameters.GetColFromLabel("Redemption", o => o.ToString()); var currencies = parameters.GetColFromLabel("RedemptionCurrency", o => Currency.Parse(o.ToString())); var payDates = parameters.GetColFromLabel("RedemptionDate", DateAndDurationConverter.ConvertDate); PaymentInfo[] payInfos = payDates.ZipWith(currencies, (d, c) => new PaymentInfo(c, d)); IFixingFunction[] redemptionPayoffs = DslPayoffFactory.Build("AutocallDate", parameters, redemptionScripts); var redemptionCoupons = redemptionPayoffs.ZipWith(payInfos, (payoff, payInfo) => new Coupon(payInfo, payoff)); var triggerScripts = parameters.GetColFromLabel("AutocallTrigger", o => o.ToString()); var triggers = DslPayoffFactory.Build("AutocallDate", parameters, triggerScripts); return(new AutoCall(underlying, parameters.RowLabels, redemptionCoupons, triggers)); }