public BMASwap(Type type, double nominal, // Libor leg Schedule liborSchedule, double liborFraction, double liborSpread, IborIndex liborIndex, DayCounter liborDayCount, // BMA leg Schedule bmaSchedule, BMAIndex bmaIndex, DayCounter bmaDayCount) : base(2) { type_ = type; nominal_ = nominal; liborFraction_ = liborFraction; liborSpread_ = liborSpread; BusinessDayConvention convention = liborSchedule.businessDayConvention(); legs_[0] = new IborLeg(liborSchedule, liborIndex) .withPaymentDayCounter(liborDayCount) .withFixingDays(liborIndex.fixingDays()) .withGearings(liborFraction) .withSpreads(liborSpread) .withNotionals(nominal) .withPaymentAdjustment(convention); legs_[1] = new AverageBMALeg(bmaSchedule, bmaIndex) .withPaymentDayCounter(bmaDayCount) .withNotionals(nominal) .withPaymentAdjustment(bmaSchedule.businessDayConvention()); for (int j = 0; j < 2; ++j) { for (int i = 0; i < legs_[j].Count; i++) { legs_[j][i].registerWith(update); } } switch (type_) { case Type.Payer: payer_[0] = +1.0; payer_[1] = -1.0; break; case Type.Receiver: payer_[0] = -1.0; payer_[1] = +1.0; break; default: Utils.QL_FAIL("Unknown BMA-swap type"); break; } }
public AverageBMACoupon(Date paymentDate, double nominal, Date startDate, Date endDate, BMAIndex index, double gearing = 1.0, double spread = 0.0, Date refPeriodStart = null, Date refPeriodEnd = null, DayCounter dayCounter = null) : base(paymentDate, nominal, startDate, endDate, index.fixingDays(), index, gearing, spread, refPeriodStart, refPeriodEnd, dayCounter) { fixingSchedule_ = index.fixingSchedule( index.fixingCalendar() .advance(startDate, new Period(-index.fixingDays(), TimeUnit.Days), BusinessDayConvention.Preceding), endDate); setPricer(new AverageBMACouponPricer()); }
public AverageBMALeg(Schedule schedule, BMAIndex index) { schedule_ = schedule; index_ = index; paymentAdjustment_ = BusinessDayConvention.Following; }