public virtual void test_createCap()
        {
            SabrIborCapletFloorletVolatilityBootstrapDefinition @base = SabrIborCapletFloorletVolatilityBootstrapDefinition.ofFixedBeta(NAME, USD_LIBOR_3M, ACT_ACT_ISDA, 0.5, STEP_UPPER, FLAT, FLAT, SabrVolatilityFormula.hagan());
            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);
        }
Пример #2
0
        /// <summary>
        /// Creates an Ibor cap/floor leg.
        /// <para>
        /// The Ibor index should be {@code EUR_EURIBOR_3M} or {@code EUR_EURIBOR_6M} to match the availability of the curve
        /// data in <seealso cref="IborCapletFloorletDataSet"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="index">  the index </param>
        /// <param name="startDate">  the start date </param>
        /// <param name="endDate">  the end date </param>
        /// <param name="strikeSchedule">  the strike </param>
        /// <param name="notionalSchedule">  the notional </param>
        /// <param name="putCall">  cap or floor </param>
        /// <param name="payRec">  pay or receive </param>
        /// <returns> the instance </returns>
        public static IborCapFloorLeg createCapFloorLegUnresolved(IborIndex index, LocalDate startDate, LocalDate endDate, ValueSchedule strikeSchedule, ValueSchedule notionalSchedule, PutCall putCall, PayReceive payRec)
        {
            Frequency           frequency       = Frequency.of(index.Tenor.Period);
            PeriodicSchedule    paySchedule     = PeriodicSchedule.of(startDate, endDate, frequency, BUSINESS_ADJ, StubConvention.NONE, RollConventions.NONE);
            IborRateCalculation rateCalculation = IborRateCalculation.of(index);

            if (putCall.Call)
            {
                return(IborCapFloorLeg.builder().calculation(rateCalculation).capSchedule(strikeSchedule).notional(notionalSchedule).paymentSchedule(paySchedule).payReceive(payRec).build());
            }
            return(IborCapFloorLeg.builder().calculation(rateCalculation).floorSchedule(strikeSchedule).notional(notionalSchedule).paymentSchedule(paySchedule).payReceive(payRec).build());
        }
Пример #3
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Creates an Ibor cap/floor leg.
        /// <para>
        /// The Ibor index should be {@code EUR_EURIBOR_3M} or {@code EUR_EURIBOR_6M} to match the availability of the curve
        /// data in <seealso cref="IborCapletFloorletDataSet"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="index">  the index </param>
        /// <param name="startDate">  the start date </param>
        /// <param name="endDate">  the end date </param>
        /// <param name="strikeSchedule">  the strike </param>
        /// <param name="notionalSchedule">  the notional </param>
        /// <param name="putCall">  cap or floor </param>
        /// <param name="payRec">  pay or receive </param>
        /// <returns> the instance </returns>
        public static ResolvedIborCapFloorLeg createCapFloorLeg(IborIndex index, LocalDate startDate, LocalDate endDate, ValueSchedule strikeSchedule, ValueSchedule notionalSchedule, PutCall putCall, PayReceive payRec)
        {
            IborCapFloorLeg leg = createCapFloorLegUnresolved(index, startDate, endDate, strikeSchedule, notionalSchedule, putCall, payRec);

            return(leg.resolve(REF_DATA));
        }