Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
 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());
 }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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));
        }