private int bmaCutoffDays = 0; // to be verified // double gearing = 1.0, double spread = 0.0, // Date refPeriodStart = Date(), Date refPeriodEnd = Date(), DayCounter dayCounter = DayCounter()); public AverageBMACoupon(double nominal, Date paymentDate, Date startDate, Date endDate, BMAIndex index, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter) : base(nominal, paymentDate, startDate, endDate, index.fixingDays(), index, gearing, spread, refPeriodStart, refPeriodEnd, dayCounter, false) { fixingSchedule_ = index.fixingSchedule( index.fixingCalendar() .advance(startDate, new Period(-index.fixingDays() + bmaCutoffDays, TimeUnit.Days), BusinessDayConvention.Preceding), endDate); setPricer(new AverageBMACouponPricer()); }
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 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: throw new ApplicationException("Unknown BMA-swap type"); } }
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 BMASwapRateHelper(Handle<Quote> liborFraction, Period tenor, int settlementDays, Calendar calendar, // bma leg Period bmaPeriod, BusinessDayConvention bmaConvention, DayCounter bmaDayCount, BMAIndex bmaIndex, // ibor leg IborIndex iborIndex) : base(liborFraction) { tenor_ = tenor; settlementDays_ = settlementDays; calendar_ = calendar; bmaPeriod_ = bmaPeriod; bmaConvention_ = bmaConvention; bmaDayCount_ = bmaDayCount; bmaIndex_ = bmaIndex; iborIndex_ = iborIndex; iborIndex_.registerWith(update); bmaIndex_.registerWith(update); initializeDates(); }
public BMASwapRateHelper(Handle <Quote> liborFraction, Period tenor, int settlementDays, Calendar calendar, // bma leg Period bmaPeriod, BusinessDayConvention bmaConvention, DayCounter bmaDayCount, BMAIndex bmaIndex, // ibor leg IborIndex iborIndex) : base(liborFraction) { tenor_ = tenor; settlementDays_ = settlementDays; calendar_ = calendar; bmaPeriod_ = bmaPeriod; bmaConvention_ = bmaConvention; bmaDayCount_ = bmaDayCount; bmaIndex_ = bmaIndex; iborIndex_ = iborIndex; iborIndex_.registerWith(update); bmaIndex_.registerWith(update); initializeDates(); }
protected override void initializeDates() { earliestDate_ = calendar_.advance(evaluationDate_, new Period(settlementDays_, TimeUnit.Days), BusinessDayConvention.Following); Date maturity = earliestDate_ + tenor_; // dummy BMA index with curve/swap arguments BMAIndex clonedIndex = new BMAIndex(termStructureHandle_); Schedule bmaSchedule = new MakeSchedule().from(earliestDate_).to(maturity) .withTenor(bmaPeriod_) .withCalendar(bmaIndex_.fixingCalendar()) .withConvention(bmaConvention_) .backwards() .value(); Schedule liborSchedule = new MakeSchedule().from(earliestDate_).to(maturity) .withTenor(iborIndex_.tenor()) .withCalendar(iborIndex_.fixingCalendar()) .withConvention(iborIndex_.businessDayConvention()) .endOfMonth(iborIndex_.endOfMonth()) .backwards() .value(); swap_ = new BMASwap(BMASwap.Type.Payer, 100.0, liborSchedule, 0.75, // arbitrary 0.0, iborIndex_, iborIndex_.dayCounter(), bmaSchedule, clonedIndex, bmaDayCount_); swap_.setPricingEngine(new DiscountingSwapEngine(iborIndex_.forwardingTermStructure())); Date d = calendar_.adjust(swap_.maturityDate(), BusinessDayConvention.Following); int w = d.weekday(); Date nextWednesday = (w >= 4) ? d + new Period((11 - w), TimeUnit.Days) : d + new Period((4 - w), TimeUnit.Days); latestDate_ = clonedIndex.valueDate(clonedIndex.fixingCalendar().adjust(nextWednesday)); }
public AverageBMALeg(Schedule schedule, BMAIndex index) { schedule_ = schedule; index_ = index; paymentAdjustment_ = BusinessDayConvention.Following; }