//-----------------------------------------------------------------------
        public virtual void floatingSwapLeg()
        {
            // a PeriodicSchedule generates a schedule of accrual periods
            // - interest is accrued every 6 months from 2014-02-12 to 2014-07-31
            // - accrual period dates are adjusted "modified following" using the "GBLO" holiday calendar
            // - there will be a long initial stub
            // - the regular accrual period dates will be at the end-of-month
            PeriodicSchedule accrualSchedule = PeriodicSchedule.builder().startDate(LocalDate.of(2014, 2, 12)).endDate(LocalDate.of(2016, 7, 31)).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.GBLO)).frequency(Frequency.P6M).stubConvention(StubConvention.LONG_INITIAL).rollConvention(RollConventions.EOM).build();
            // a PaymentSchedule generates a schedule of payment periods, based on the accrual schedule
            // - payments are every 6 months
            // - payments are 2 business days after the end of the period
            // - no compounding is needed as the payment schedule matches the accrual schedule
            PaymentSchedule paymentSchedule = PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentRelativeTo(PaymentRelativeTo.PERIOD_END).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, HolidayCalendarIds.GBLO)).build();
            // a NotionalSchedule generates a schedule of notional amounts, based on the payment schedule
            // - in this simple case the notional is 1 million GBP and does not change
            NotionalSchedule notionalSchedule = NotionalSchedule.of(Currency.GBP, 1_000_000);
            // a RateCalculationSwapLeg can represent a fixed or floating swap leg
            // - an IborRateCalculation is used to represent a floating Ibor rate
            // - the "Act/Act ISDA" day count is used
            // - the index is GBP LIBOR 6M
            // - fixing is 2 days before the start of the period using the "GBLO" holiday calendar
            RateCalculationSwapLeg swapLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).notionalSchedule(notionalSchedule).calculation(IborRateCalculation.builder().dayCount(DayCounts.ACT_ACT_ISDA).index(IborIndices.GBP_LIBOR_6M).fixingRelativeTo(FixingRelativeTo.PERIOD_START).fixingDateOffset(DaysAdjustment.ofBusinessDays(-2, HolidayCalendarIds.GBLO)).build()).build();
            // a ResolvedSwapLeg has all the dates of the cash flows
            // it remains valid so long as the holiday calendar does not change
            ResolvedSwapLeg resolvedLeg = swapLeg.resolve(ReferenceData.standard());

            Console.WriteLine("===== Floating =====");
            Console.WriteLine(JodaBeanSer.PRETTY.xmlWriter().write(swapLeg));
            Console.WriteLine();
            Console.WriteLine("===== Floating resolved =====");
            Console.WriteLine(JodaBeanSer.PRETTY.xmlWriter().write(resolvedLeg));
            Console.WriteLine();
        }
        //-----------------------------------------------------------------------
        public virtual void fixedSwapLeg()
        {
            // a PeriodicSchedule generates a schedule of accrual periods
            // - interest is accrued every 3 months from 2014-02-12 to 2014-07-31
            // - accrual period dates are adjusted "modified following" using the "GBLO" holiday calendar
            // - there will be a long initial stub
            // - the regular accrual period dates will be at the end-of-month
            PeriodicSchedule accrualSchedule = PeriodicSchedule.builder().startDate(LocalDate.of(2014, 2, 12)).endDate(LocalDate.of(2016, 7, 31)).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.GBLO)).frequency(Frequency.P3M).stubConvention(StubConvention.LONG_INITIAL).rollConvention(RollConventions.EOM).build();
            // a PaymentSchedule generates a schedule of payment periods, based on the accrual schedule
            // - payments are every 6 months
            // - payments are 2 business days after the end of the period
            // - straight compounding is used (the payments are less frequent than the accrual, so compounding occurs)
            PaymentSchedule paymentSchedule = PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentRelativeTo(PaymentRelativeTo.PERIOD_END).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, HolidayCalendarIds.GBLO)).compoundingMethod(CompoundingMethod.STRAIGHT).build();
            // a NotionalSchedule generates a schedule of notional amounts, based on the payment schedule
            // - in this simple case the notional is 1 million GBP and does not change
            NotionalSchedule notionalSchedule = NotionalSchedule.of(Currency.GBP, 1_000_000);
            // a RateCalculationSwapLeg can represent a fixed or floating swap leg
            // - a FixedRateCalculation is used to represent a fixed rate
            // - the "Act/Act ISDA" day count is used
            // - the rate starts at 0.8% and reduces to 0.7%
            RateCalculationSwapLeg swapLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).notionalSchedule(notionalSchedule).calculation(FixedRateCalculation.builder().dayCount(DayCounts.ACT_ACT_ISDA).rate(ValueSchedule.of(0.008, ValueStep.of(LocalDate.of(2015, 1, 31), ValueAdjustment.ofReplace(0.007)))).build()).build();
            // a ResolvedSwapLeg has all the dates of the cash flows
            // it remains valid so long as the holiday calendar does not change
            ResolvedSwapLeg resolvedLeg = swapLeg.resolve(ReferenceData.standard());

            Console.WriteLine("===== Fixed =====");
            Console.WriteLine(JodaBeanSer.PRETTY.xmlWriter().write(swapLeg));
            Console.WriteLine();
            Console.WriteLine("===== Fixed resolved =====");
            Console.WriteLine(JodaBeanSer.PRETTY.xmlWriter().write(resolvedLeg));
            Console.WriteLine();
        }
        // Create a compounding fixed vs fed funds swap
        private static Trade createCompoundingFixedVsFedFundsSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 2, 5)).endDate(LocalDate.of(2014, 4, 7)).frequency(Frequency.TERM).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.TERM).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(FixedRateCalculation.of(0.00123, DayCounts.ACT_360)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 2, 5)).endDate(LocalDate.of(2014, 4, 7)).frequency(Frequency.TERM).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).stubConvention(StubConvention.SHORT_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.TERM).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(OvernightRateCalculation.of(OvernightIndices.USD_FED_FUND)).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "11")).addAttribute(AttributeType.DESCRIPTION, "Compounding fixed vs fed funds").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 2, 5)).build()).build());
        }
        // Create a compounding libor 6m vs libor 3m swap
        private static Trade createCompoundingLibor6mVsLibor3mSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 8, 27)).endDate(LocalDate.of(2024, 8, 27)).frequency(Frequency.P6M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_6M)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 8, 27)).endDate(LocalDate.of(2024, 8, 27)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).compoundingMethod(CompoundingMethod.STRAIGHT).build()).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_3M)).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "13")).addAttribute(AttributeType.DESCRIPTION, "Compounding libor 6m vs libor 3m").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 8, 27)).build()).build());
        }
        // Create an overnight averaged vs libor 3m swap with spread
        private static Trade createOvernightAveragedWithSpreadVsLibor3mSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2020, 9, 12)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_3M)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2020, 9, 12)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(OvernightRateCalculation.builder().dayCount(DayCounts.ACT_360).index(OvernightIndices.USD_FED_FUND).accrualMethod(OvernightAccrualMethod.AVERAGED).spread(ValueSchedule.of(0.0025)).build()).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "3")).addAttribute(AttributeType.DESCRIPTION, "Fed Funds averaged + spread vs Libor 3m").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 9, 12)).build()).build());
        }
        // Create a fixed vs libor 6m swap
        private static Trade createInterpolatedStub4mFixedVsLibor6mSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 7, 12)).frequency(Frequency.P6M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).stubConvention(StubConvention.SHORT_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.builder().index(IborIndices.USD_LIBOR_6M).initialStub(IborRateStubCalculation.ofIborInterpolatedRate(IborIndices.USD_LIBOR_3M, IborIndices.USD_LIBOR_6M)).build()).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 7, 12)).stubConvention(StubConvention.SHORT_INITIAL).frequency(Frequency.P6M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(FixedRateCalculation.of(0.01, DayCounts.THIRTY_U_360)).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "9")).addAttribute(AttributeType.DESCRIPTION, "Fixed vs Libor 6m (interpolated 4m short initial stub)").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 9, 12)).build()).build());
        }
        private static Trade createTrade1()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 12_000_000);

            PeriodicSchedule accrual = PeriodicSchedule.builder().startDate(LocalDate.of(2006, 2, 24)).endDate(LocalDate.of(2011, 2, 24)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build();

            PaymentSchedule payment = PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, HolidayCalendarIds.USNY)).build();

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(accrual).paymentSchedule(payment).notionalSchedule(notional).calculation(FixedRateCalculation.of(0.05004, DayCounts.ACT_360)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(accrual).paymentSchedule(payment).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_3M)).build();

            return(SwapTrade.builder().product(Swap.builder().legs(payLeg, receiveLeg).build()).info(TradeInfo.builder().id(StandardId.of("mn", "14248")).counterparty(StandardId.of("mn", "Dealer A")).settlementDate(LocalDate.of(2006, 2, 24)).build()).build());
        }
        //-------------------------------------------------------------------------
        public virtual void test_toLeg()
        {
            InflationRateSwapLegConvention @base = InflationRateSwapLegConvention.of(GB_HICP, LAG_3M, MONTHLY, BDA_MOD_FOLLOW);
            LocalDate startDate         = LocalDate.of(2015, 5, 5);
            LocalDate endDate           = LocalDate.of(2020, 5, 5);
            RateCalculationSwapLeg test = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M);

            RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(Frequency.TERM).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.TERM).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(InflationRateCalculation.of(GB_HICP, 3, MONTHLY)).build();

            assertEquals(test, expected);
        }
        public virtual void test_toLeg_withSpread()
        {
            IborRateSwapLegConvention @base = IborRateSwapLegConvention.builder().index(GBP_LIBOR_3M).build();
            LocalDate startDate             = LocalDate.of(2015, 5, 5);
            LocalDate endDate               = LocalDate.of(2020, 5, 5);
            RateCalculationSwapLeg test     = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d);
            RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(P3M).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(IborRateCalculation.builder().index(GBP_LIBOR_3M).spread(ValueSchedule.of(0.25d)).build()).build();

            assertEquals(test, expected);
        }
        // create a cross-currency USD fixed vs GBP libor 3m swap
        private static SwapTrade createXCcyUsdFixedVsGbpLibor3mSwap()
        {
            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 1, 24)).endDate(LocalDate.of(2021, 1, 24)).frequency(Frequency.P6M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.GBLO)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(Currency.USD, 100_000_000)).calculation(FixedRateCalculation.of(0.03, DayCounts.THIRTY_U_360)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 1, 24)).endDate(LocalDate.of(2021, 1, 24)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.GBLO)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(Currency.GBP, 61_600_000)).calculation(IborRateCalculation.of(IborIndices.GBP_LIBOR_3M)).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "15")).addAttribute(AttributeType.DESCRIPTION, "USD fixed vs GBP Libor 3m").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 1, 24)).build()).build());
        }
Example #11
0
        //-------------------------------------------------------------------------
        public virtual void test_toLeg()
        {
            FixedRateSwapLegConvention @base = FixedRateSwapLegConvention.of(GBP, ACT_365F, P3M, BDA_MOD_FOLLOW);
            LocalDate startDate             = LocalDate.of(2015, 5, 5);
            LocalDate endDate               = LocalDate.of(2020, 5, 5);
            RateCalculationSwapLeg test     = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d);
            RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(P3M).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).stubConvention(StubConvention.SMART_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(FixedRateCalculation.of(0.25d, ACT_365F)).build();

            assertEquals(test, expected);
        }
Example #12
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates a leg based on this convention.
 /// <para>
 /// This returns a leg based on the specified date.
 /// The notional is unsigned, with pay/receive determining the direction of the leg.
 /// If the leg is 'Pay', the fixed rate is paid to the counterparty.
 /// If the leg is 'Receive', the fixed rate is received from the counterparty.
 ///
 /// </para>
 /// </summary>
 /// <param name="startDate">  the start date </param>
 /// <param name="endDate">  the end date </param>
 /// <param name="payReceive">  determines if the leg is to be paid or received </param>
 /// <param name="notional">  the business day adjustment to apply to accrual schedule dates </param>
 /// <returns> the leg </returns>
 public RateCalculationSwapLeg toLeg(LocalDate startDate, LocalDate endDate, PayReceive payReceive, double notional)
 {
     return(RateCalculationSwapLeg.builder().payReceive(payReceive).accrualSchedule(PeriodicSchedule.builder().startDate(startDate).endDate(endDate).frequency(Frequency.TERM).businessDayAdjustment(accrualBusinessDayAdjustment).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.TERM).paymentDateOffset(paymentDateOffset).build()).calculation(InflationRateCalculation.builder().index(index).indexCalculationMethod(indexCalculationMethod).lag(lag).build()).notionalSchedule(NotionalSchedule.of(Currency, notional)).build());
 }
        //-------------------------------------------------------------------------
        public virtual void test_toLeg()
        {
            OvernightRateSwapLegConvention @base = OvernightRateSwapLegConvention.of(GBP_SONIA, TERM, 2);
            LocalDate startDate             = LocalDate.of(2015, 5, 5);
            LocalDate endDate               = LocalDate.of(2020, 5, 5);
            RateCalculationSwapLeg test     = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M);
            RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(TERM).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).stubConvention(StubConvention.SMART_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(TERM).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBP_SONIA.FixingCalendar)).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(OvernightRateCalculation.of(GBP_SONIA)).build();

            assertEquals(test, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_AmortizingFixedVsLibor3mSwap()
        {
            ValueAdjustment   stepReduction = ValueAdjustment.ofDeltaAmount(-3_000_000);
            IList <ValueStep> steps         = new List <ValueStep>();

            for (int i = 1; i < 28; i++)
            {
                steps.Add(ValueStep.of(i, stepReduction));
            }
            ValueSchedule notionalSchedule = ValueSchedule.of(100_000_000, steps);
            SwapLeg       receiveLeg       = RateCalculationSwapLeg.builder().payReceive(RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2021, 9, 12)).frequency(P3M).businessDayAdjustment(BDA_MF).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(USD, notionalSchedule)).calculation(FixedRateCalculation.builder().dayCount(THIRTY_U_360).rate(ValueSchedule.of(0.016)).build()).build();

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2021, 9, 12)).frequency(P3M).businessDayAdjustment(BDA_MF).stubConvention(StubConvention.SHORT_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(USD, notionalSchedule)).calculation(IborRateCalculation.builder().index(USD_LIBOR_3M).fixingDateOffset(DaysAdjustment.ofBusinessDays(-2, CalendarUSD.NYC, BDA_P)).build()).build();

            ResolvedSwapTrade trade = SwapTrade.builder().info(TradeInfo.builder().tradeDate(LocalDate.of(2014, 9, 10)).build()).product(Swap.of(receiveLeg, payLeg)).build().resolve(REF_DATA);

            DiscountingSwapTradePricer pricer = swapPricer();
            CurrencyAmount             pv     = pricer.presentValue(trade, provider()).getAmount(USD);

            assertEquals(pv.Amount, -1850080.2895532502, TOLERANCE_PV);
        }