Exemplo n.º 1
0
        public virtual void test_createCap()
        {
            SurfaceIborCapletFloorletVolatilityBootstrapDefinition @base = SurfaceIborCapletFloorletVolatilityBootstrapDefinition.of(NAME, USD_LIBOR_3M, ACT_ACT_ISDA, TIME_SQUARE, DOUBLE_QUADRATIC);
            LocalDate       startDate = LocalDate.of(2012, 4, 20);
            LocalDate       endDate   = LocalDate.of(2017, 4, 20);
            double          strike    = 0.01;
            IborCapFloorLeg expected  = IborCapFloorLeg.builder().calculation(IborRateCalculation.of(USD_LIBOR_3M)).capSchedule(ValueSchedule.of(strike)).currency(USD_LIBOR_3M.Currency).notional(ValueSchedule.ALWAYS_1).paymentDateOffset(DaysAdjustment.NONE).paymentSchedule(PeriodicSchedule.of(startDate, endDate, Frequency.of(USD_LIBOR_3M.Tenor.Period), BusinessDayAdjustment.of(BusinessDayConventions.MODIFIED_FOLLOWING, USD_LIBOR_3M.FixingCalendar), StubConvention.NONE, RollConventions.NONE)).payReceive(PayReceive.RECEIVE).build();
            IborCapFloorLeg computed  = @base.createCap(startDate, endDate, strike);

            assertEquals(computed, expected);
        }
        static CapletStrippingSetup()
        {
            LocalDate startDate = BASE_DATE.plus(USD_LIBOR_3M.Tenor);

            for (int i = 0; i < NUM_BLACK_MATURITIES; ++i)
            {
                for (int j = 0; j < NUM_BLACK_STRIKES; ++j)
                {
                    CAPS_BLACK[j][i] = IborCapFloorLeg.builder().calculation(IborRateCalculation.of(USD_LIBOR_3M)).capSchedule(ValueSchedule.of(CAP_BLACK_STRIKES[j])).notional(ValueSchedule.ALWAYS_1).paymentSchedule(PeriodicSchedule.of(startDate, BASE_DATE.plusYears(CAP_BLACK_END_TIMES[i]), Frequency.P3M, BusinessDayAdjustment.of(BusinessDayConventions.MODIFIED_FOLLOWING, USD_LIBOR_3M.FixingCalendar), StubConvention.NONE, RollConventions.NONE)).payReceive(PayReceive.RECEIVE).build().resolve(REF_DATA);
                }
            }
            for (int i = 0; i < NUM_NORMAL_MATURITIES; ++i)
            {
                for (int j = 0; j < NUM_NORMAL_STRIKES; ++j)
                {
                    CAPS_NORMAL[j][i] = IborCapFloorLeg.builder().calculation(IborRateCalculation.of(USD_LIBOR_3M)).capSchedule(ValueSchedule.of(CAP_NORMAL_STRIKES[j])).notional(ValueSchedule.ALWAYS_1).paymentSchedule(PeriodicSchedule.of(startDate, BASE_DATE.plusYears(CAP_NORMAL_END_TIMES[i]), Frequency.P3M, BusinessDayAdjustment.of(BusinessDayConventions.MODIFIED_FOLLOWING, USD_LIBOR_3M.FixingCalendar), StubConvention.NONE, RollConventions.NONE)).payReceive(PayReceive.RECEIVE).build().resolve(REF_DATA);
                }
            }
        }