public virtual void test_inflation_fixed()
        {
            BusinessDayAdjustment  bda              = BusinessDayAdjustment.of(FOLLOWING, GBLO);
            PeriodicSchedule       accrualSchedule  = PeriodicSchedule.builder().startDate(DATE_14_06_09).endDate(DATE_19_06_09).frequency(P12M).businessDayAdjustment(bda).build();
            PaymentSchedule        paymentSchedule  = PaymentSchedule.builder().paymentFrequency(Frequency.ofYears(5)).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)).compoundingMethod(STRAIGHT).build();
            FixedRateCalculation   rateCalc         = FixedRateCalculation.builder().rate(ValueSchedule.of(0.05)).dayCount(ONE_ONE).build();
            NotionalSchedule       notionalSchedule = NotionalSchedule.of(GBP, 1000d);
            RateCalculationSwapLeg test             = RateCalculationSwapLeg.builder().payReceive(RECEIVE).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).notionalSchedule(notionalSchedule).calculation(rateCalc).build();

            assertEquals(test.StartDate, AdjustableDate.of(DATE_14_06_09, bda));
            assertEquals(test.EndDate, AdjustableDate.of(DATE_19_06_09, bda));
            assertEquals(test.Currency, GBP);
            assertEquals(test.PayReceive, RECEIVE);
            assertEquals(test.AccrualSchedule, accrualSchedule);
            assertEquals(test.PaymentSchedule, paymentSchedule);
            assertEquals(test.NotionalSchedule, notionalSchedule);
            assertEquals(test.Calculation, rateCalc);
            RateAccrualPeriod rap0       = RateAccrualPeriod.builder().startDate(bda.adjust(DATE_14_06_09, REF_DATA)).endDate(bda.adjust(DATE_14_06_09.plusYears(1), REF_DATA)).unadjustedStartDate(DATE_14_06_09).unadjustedEndDate(DATE_14_06_09.plusYears(1)).yearFraction(1.0).rateComputation(FixedRateComputation.of(0.05)).build();
            RateAccrualPeriod rap1       = RateAccrualPeriod.builder().startDate(bda.adjust(DATE_14_06_09.plusYears(1), REF_DATA)).endDate(bda.adjust(DATE_14_06_09.plusYears(2), REF_DATA)).unadjustedStartDate(DATE_14_06_09.plusYears(1)).unadjustedEndDate(DATE_14_06_09.plusYears(2)).yearFraction(1.0).rateComputation(FixedRateComputation.of(0.05)).build();
            RateAccrualPeriod rap2       = RateAccrualPeriod.builder().startDate(bda.adjust(DATE_14_06_09.plusYears(2), REF_DATA)).endDate(bda.adjust(DATE_14_06_09.plusYears(3), REF_DATA)).unadjustedStartDate(DATE_14_06_09.plusYears(2)).unadjustedEndDate(DATE_14_06_09.plusYears(3)).yearFraction(1.0).rateComputation(FixedRateComputation.of(0.05)).build();
            RateAccrualPeriod rap3       = RateAccrualPeriod.builder().startDate(bda.adjust(DATE_14_06_09.plusYears(3), REF_DATA)).endDate(bda.adjust(DATE_14_06_09.plusYears(4), REF_DATA)).unadjustedStartDate(DATE_14_06_09.plusYears(3)).unadjustedEndDate(DATE_14_06_09.plusYears(4)).yearFraction(1.0).rateComputation(FixedRateComputation.of(0.05)).build();
            RateAccrualPeriod rap4       = RateAccrualPeriod.builder().startDate(bda.adjust(DATE_14_06_09.plusYears(4), REF_DATA)).endDate(bda.adjust(DATE_19_06_09, REF_DATA)).unadjustedStartDate(DATE_14_06_09.plusYears(4)).unadjustedEndDate(DATE_19_06_09).yearFraction(1.0).rateComputation(FixedRateComputation.of(0.05)).build();
            RatePaymentPeriod rpp        = RatePaymentPeriod.builder().paymentDate(DaysAdjustment.ofBusinessDays(2, GBLO).adjust(bda.adjust(DATE_19_06_09, REF_DATA), REF_DATA)).accrualPeriods(rap0, rap1, rap2, rap3, rap4).compoundingMethod(STRAIGHT).dayCount(ONE_ONE).currency(GBP).notional(1000d).build();
            ResolvedSwapLeg   expected   = ResolvedSwapLeg.builder().paymentPeriods(rpp).payReceive(RECEIVE).type(SwapLegType.FIXED).build();
            ResolvedSwapLeg   testExpand = test.resolve(REF_DATA);

            assertEquals(testExpand, expected);
        }
Ejemplo n.º 2
0
        internal static FixedCouponBond sut2()
        {
            BusinessDayAdjustment adj  = BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN);
            PeriodicSchedule      sche = PeriodicSchedule.of(START_DATE, END_DATE, Frequency.P12M, adj, StubConvention.SHORT_INITIAL, true);

            return(FixedCouponBond.builder().securityId(SECURITY_ID2).dayCount(DayCounts.ACT_360).fixedRate(0.005).legalEntityId(LegalEntityId.of("OG-Ticker", "BUN EUR 2")).currency(GBP).notional(1.0e6).accrualSchedule(sche).settlementDateOffset(DaysAdjustment.ofBusinessDays(2, SAT_SUN)).yieldConvention(FixedCouponBondYieldConvention.GB_BUMP_DMO).build());
        }
        public virtual void test_inflation_interpolated()
        {
            BusinessDayAdjustment    bda              = BusinessDayAdjustment.of(FOLLOWING, GBLO);
            PeriodicSchedule         accrualSchedule  = PeriodicSchedule.builder().startDate(DATE_14_06_09).endDate(DATE_19_06_09).frequency(Frequency.ofYears(5)).businessDayAdjustment(bda).build();
            PaymentSchedule          paymentSchedule  = PaymentSchedule.builder().paymentFrequency(Frequency.ofYears(5)).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)).build();
            InflationRateCalculation rateCalc         = InflationRateCalculation.builder().index(GB_RPI).indexCalculationMethod(INTERPOLATED).lag(Period.ofMonths(3)).build();
            NotionalSchedule         notionalSchedule = NotionalSchedule.of(GBP, 1000d);
            RateCalculationSwapLeg   test             = RateCalculationSwapLeg.builder().payReceive(RECEIVE).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).notionalSchedule(notionalSchedule).calculation(rateCalc).build();

            assertEquals(test.StartDate, AdjustableDate.of(DATE_14_06_09, bda));
            assertEquals(test.EndDate, AdjustableDate.of(DATE_19_06_09, bda));
            assertEquals(test.Currency, GBP);
            assertEquals(test.PayReceive, RECEIVE);
            assertEquals(test.AccrualSchedule, accrualSchedule);
            assertEquals(test.PaymentSchedule, paymentSchedule);
            assertEquals(test.NotionalSchedule, notionalSchedule);
            assertEquals(test.Calculation, rateCalc);

            double            weight     = 1.0 - 9.0 / 30.0;
            RatePaymentPeriod rpp0       = RatePaymentPeriod.builder().paymentDate(DaysAdjustment.ofBusinessDays(2, GBLO).adjust(bda.adjust(DATE_19_06_09, REF_DATA), REF_DATA)).accrualPeriods(RateAccrualPeriod.builder().startDate(bda.adjust(DATE_14_06_09, REF_DATA)).endDate(bda.adjust(DATE_19_06_09, REF_DATA)).unadjustedStartDate(DATE_14_06_09).unadjustedEndDate(DATE_19_06_09).yearFraction(1.0).rateComputation(InflationInterpolatedRateComputation.of(GB_RPI, YearMonth.from(bda.adjust(DATE_14_06_09, REF_DATA)).minusMonths(3), YearMonth.from(bda.adjust(DATE_19_06_09, REF_DATA)).minusMonths(3), weight)).build()).dayCount(ONE_ONE).currency(GBP).notional(1000d).build();
            ResolvedSwapLeg   expected   = ResolvedSwapLeg.builder().paymentPeriods(rpp0).payReceive(RECEIVE).type(SwapLegType.INFLATION).build();
            ResolvedSwapLeg   testExpand = test.resolve(REF_DATA);

            assertEquals(testExpand, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder_ensureDefaults()
        {
            ResetSchedule test = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();

            assertEquals(test.ResetFrequency, P1M);
            assertEquals(test.BusinessDayAdjustment, BusinessDayAdjustment.of(FOLLOWING, GBLO));
            assertEquals(test.ResetMethod, UNWEIGHTED);
        }
        //-------------------------------------------------------------------------
        public virtual void test_of_nobda()
        {
            ImmutableFxSwapConvention test = ImmutableFxSwapConvention.of(EUR_USD, PLUS_TWO_DAYS);

            assertEquals(test.Name, EUR_USD.ToString());
            assertEquals(test.CurrencyPair, EUR_USD);
            assertEquals(test.SpotDateOffset, PLUS_TWO_DAYS);
            assertEquals(test.BusinessDayAdjustment, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, EUTA_USNY));
        }
 // adjust trade based on additional fields specified
 private static TermDepositTrade adjustTrade(TermDepositTrade trade, BusinessDayConvention dateCnv, Optional <HolidayCalendarId> dateCalOpt)
 {
     if (!dateCalOpt.Present)
     {
         return(trade);
     }
     TermDeposit.Builder builder = trade.Product.toBuilder();
     dateCalOpt.ifPresent(cal => builder.businessDayAdjustment(BusinessDayAdjustment.of(dateCnv, cal)));
     return(trade.toBuilder().product(builder.build()).build());
 }
Ejemplo n.º 7
0
        public virtual void test_of_indexOnly()
        {
            ImmutableIborFixingDepositConvention test = ImmutableIborFixingDepositConvention.of(GBP_LIBOR_6M);

            assertEquals(test.BusinessDayAdjustment, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBP_LIBOR_6M.FixingCalendar));
            assertEquals(test.Currency, GBP_LIBOR_6M.Currency);
            assertEquals(test.DayCount, GBP_LIBOR_6M.DayCount);
            assertEquals(test.FixingDateOffset, GBP_LIBOR_6M.FixingDateOffset);
            assertEquals(test.Index, GBP_LIBOR_6M);
            assertEquals(test.SpotDateOffset, GBP_LIBOR_6M.EffectiveDateOffset);
        }
Ejemplo n.º 8
0
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @DataProvider(name = "businessDayAdjustment") public static Object[][] data_businessDayAdjustment()
        public static object[][] data_businessDayAdjustment()
        {
            return(new object[][]
            {
                new object[] { CdsConventions.EUR_GB_STANDARD, BusinessDayAdjustment.of(FOLLOWING, GBLO_EUTA) },
                new object[] { CdsConventions.EUR_STANDARD, BusinessDayAdjustment.of(FOLLOWING, EUTA) },
                new object[] { CdsConventions.GBP_STANDARD, BusinessDayAdjustment.of(FOLLOWING, GBLO) },
                new object[] { CdsConventions.GBP_US_STANDARD, BusinessDayAdjustment.of(FOLLOWING, GBLO_USNY) },
                new object[] { CdsConventions.JPY_STANDARD, BusinessDayAdjustment.of(FOLLOWING, JPTO) },
                new object[] { CdsConventions.JPY_US_GB_STANDARD, BusinessDayAdjustment.of(FOLLOWING, GBLO_USNY_JPTO) },
                new object[] { CdsConventions.USD_STANDARD, BusinessDayAdjustment.of(FOLLOWING, USNY) }
            });
        }
Ejemplo n.º 9
0
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            FxSwapTemplate        @base     = FxSwapTemplate.of(NEAR_PERIOD, FAR_PERIOD, CONVENTION);
            LocalDate             tradeDate = LocalDate.of(2015, 10, 29);
            FxSwapTrade           test      = @base.createTrade(tradeDate, BUY, NOTIONAL_EUR, FX_RATE_NEAR, FX_RATE_PTS, REF_DATA);
            LocalDate             spotDate  = PLUS_TWO_DAYS.adjust(tradeDate, REF_DATA);
            LocalDate             nearDate  = spotDate.plus(NEAR_PERIOD);
            LocalDate             farDate   = spotDate.plus(FAR_PERIOD);
            BusinessDayAdjustment bda       = CONVENTION.BusinessDayAdjustment;
            FxSwap expected = FxSwap.ofForwardPoints(CurrencyAmount.of(EUR, NOTIONAL_EUR), FxRate.of(EUR, USD, FX_RATE_NEAR), FX_RATE_PTS, nearDate, farDate, bda);

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
Ejemplo n.º 10
0
        public virtual void test_zar_jibar()
        {
            IborIndex test = IborIndex.of("ZAR-JIBAR-3M");

            assertEquals(test.Currency, ZAR);
            assertEquals(test.Name, "ZAR-JIBAR-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, ZAJO);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(PRECEDING, ZAJO)));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(FOLLOWING, ZAJO)));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_3M, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, ZAJO)));
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.DefaultFixedLegDayCount, ACT_365F);
            assertEquals(test.ToString(), "ZAR-JIBAR-3M");
        }
        public virtual void test_expiry_standard()
        {
            DaysAdjustment        spotLag = DaysAdjustment.ofBusinessDays(2, LO_NY);
            BusinessDayAdjustment bda     = BusinessDayAdjustment.of(BusinessDayConventions.FOLLOWING, LO_NY);

            FxOptionVolatilitiesNode[] nodes    = new FxOptionVolatilitiesNode[] { FxOptionVolatilitiesNode.of(GBP_USD, spotLag, bda, ValueType.BLACK_VOLATILITY, QUOTE_ID, Tenor.TENOR_2M, STRIKE), FxOptionVolatilitiesNode.of(GBP_USD, spotLag, bda, ValueType.BLACK_VOLATILITY, QUOTE_ID, Tenor.TENOR_10M, STRIKE), FxOptionVolatilitiesNode.of(GBP_USD, spotLag, bda, ValueType.BLACK_VOLATILITY, QUOTE_ID, Tenor.TENOR_4M, STRIKE) };
            ZonedDateTime[]            valDates = new ZonedDateTime[] { LocalDate.of(2017, 10, 25).atStartOfDay(ZoneId.of("Europe/London")), LocalDate.of(2017, 10, 25).atStartOfDay(ZoneId.of("Europe/London")), LocalDate.of(2017, 10, 27).atStartOfDay(ZoneId.of("Europe/London")) };
            LocalDate[] expDates = new LocalDate[] { LocalDate.of(2017, 12, 21), LocalDate.of(2018, 8, 23), LocalDate.of(2018, 2, 26) };
            for (int i = 0; i < expDates.Length; ++i)
            {
                double computed = nodes[i].timeToExpiry(valDates[i], ACT_365F, REF_DATA);
                double expected = ACT_365F.relativeYearFraction(valDates[i].toLocalDate(), expDates[i]);
                assertEquals(computed, expected);
            }
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            BusinessDayAdjustment bda             = BusinessDayAdjustment.of(FOLLOWING, GBLO);
            PeriodicSchedule      accrualSchedule = PeriodicSchedule.builder().startDate(DATE_01_05).endDate(DATE_04_05).frequency(P1M).businessDayAdjustment(bda).build();
            PaymentSchedule       paymentSchedule = PaymentSchedule.builder().paymentFrequency(P1M).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)).build();
            ValueSchedule         amountSchedule  = ValueSchedule.of(123d);
            KnownAmountSwapLeg    test            = KnownAmountSwapLeg.builder().payReceive(PAY).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).amount(amountSchedule).currency(GBP).build();

            assertEquals(test.PayReceive, PAY);
            assertEquals(test.StartDate, AdjustableDate.of(DATE_01_05, bda));
            assertEquals(test.EndDate, AdjustableDate.of(DATE_04_05, bda));
            assertEquals(test.AccrualSchedule, accrualSchedule);
            assertEquals(test.PaymentSchedule, paymentSchedule);
            assertEquals(test.Amount, amountSchedule);
            assertEquals(test.Currency, GBP);
            assertEquals(test.allCurrencies(), ImmutableSet.of(GBP));
        }
Ejemplo n.º 13
0
        private static readonly HolidayCalendarId NZBD = HolidayCalendarId.of("NZBD");   // no constant for this

        public virtual void test_gbpLibor3m()
        {
            IborIndex test = IborIndex.of("GBP-LIBOR-3M");

            assertEquals(test.Name, "GBP-LIBOR-3M");
            assertEquals(test.Currency, GBP);
            assertEquals(test.Active, true);
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, GBLO);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(PRECEDING, GBLO)));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(FOLLOWING, GBLO)));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.ofLastBusinessDay(TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO)));
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.DefaultFixedLegDayCount, ACT_365F);
            assertEquals(test.FloatingRateName, FloatingRateName.of("GBP-LIBOR"));
            assertEquals(test.ToString(), "GBP-LIBOR-3M");
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            BusinessDayAdjustment  bda              = BusinessDayAdjustment.of(FOLLOWING, GBLO);
            PeriodicSchedule       accrualSchedule  = PeriodicSchedule.builder().startDate(DATE_01_05).endDate(DATE_04_05).frequency(P1M).businessDayAdjustment(bda).build();
            PaymentSchedule        paymentSchedule  = PaymentSchedule.builder().paymentFrequency(P1M).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)).build();
            FixedRateCalculation   rateCalc         = FixedRateCalculation.builder().dayCount(DayCounts.ACT_365F).rate(ValueSchedule.of(0.025d)).build();
            NotionalSchedule       notionalSchedule = NotionalSchedule.of(GBP, 1000d);
            RateCalculationSwapLeg test             = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).notionalSchedule(notionalSchedule).calculation(rateCalc).build();

            assertEquals(test.StartDate, AdjustableDate.of(DATE_01_05, bda));
            assertEquals(test.EndDate, AdjustableDate.of(DATE_04_05, bda));
            assertEquals(test.Currency, GBP);
            assertEquals(test.PayReceive, PAY);
            assertEquals(test.AccrualSchedule, accrualSchedule);
            assertEquals(test.PaymentSchedule, paymentSchedule);
            assertEquals(test.NotionalSchedule, notionalSchedule);
            assertEquals(test.Calculation, rateCalc);
        }
        // parses the payment date adjustment, which consists of two linked optional fields
        internal static Optional <BusinessDayAdjustment> parsePaymentDateAdjustment(CsvRow row)
        {
            Optional <BusinessDayAdjustment> paymentAdj = null;
            Optional <string> paymentDateCnv            = row.findValue(PAYMENT_DATE_CNV_FIELD); // Optional field with Business day adjustment

            if (paymentDateCnv.Present)
            {
                BusinessDayConvention bdCnv = LoaderUtils.parseBusinessDayConvention(paymentDateCnv.get());
                if (!bdCnv.Equals(BusinessDayConventions.NO_ADJUST))
                {
                    Optional <string> paymentDateCalOpt = row.findValue(PAYMENT_DATE_CAL_FIELD);
                    if (paymentDateCalOpt.Present)
                    {
                        paymentAdj = BusinessDayAdjustment.of(LoaderUtils.parseBusinessDayConvention(paymentDateCnv.get()), HolidayCalendarId.of(paymentDateCalOpt.get()));
                    }
                }
            }
            return(paymentAdj);
        }
Ejemplo n.º 16
0
        public virtual void test_krw_cd()
        {
            HolidayCalendarId KRSE = HolidayCalendarId.of("KRSE");
            IborIndex         test = IborIndex.of("KRW-CD-13W");

            assertEquals(test.Currency, KRW);
            assertEquals(test.Name, "KRW-CD-13W");
            assertEquals(test.Tenor, TENOR_13W);
            assertEquals(test.FixingCalendar, KRSE);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-1, KRSE));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(1, KRSE));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_13W, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(FOLLOWING, KRSE)));
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.DefaultFixedLegDayCount, ACT_365F);
            assertEquals(test.ToString(), "KRW-CD-13W");

            IborIndex test2 = IborIndex.of("KRW-CD-3M");

            assertEquals(test2.Name, "KRW-CD-13W");
        }
Ejemplo n.º 17
0
        public virtual void test_bbsw6m()
        {
            IborIndex test = IborIndex.of("AUD-BBSW-6M");

            assertEquals(test.Currency, AUD);
            assertEquals(test.Name, "AUD-BBSW-6M");
            assertEquals(test.Tenor, TENOR_6M);
            assertEquals(test.FixingCalendar, AUSY);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-1, AUSY));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(1, AUSY));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_6M, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(MODIFIED_FOLLOWING_BI_MONTHLY, AUSY)));
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.ToString(), "AUD-BBSW-6M");
        }
Ejemplo n.º 18
0
        public virtual void test_tibor_euroyen3m()
        {
            IborIndex test = IborIndex.of("JPY-TIBOR-EUROYEN-3M");

            assertEquals(test.Currency, JPY);
            assertEquals(test.Name, "JPY-TIBOR-EUROYEN-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, JPTO);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, JPTO));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(2, JPTO));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.ofLastBusinessDay(TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, JPTO)));
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.DefaultFixedLegDayCount, ACT_365F);
            assertEquals(test.FloatingRateName, FloatingRateName.of("JPY-TIBOR-EUROYEN"));
            assertEquals(test.ToString(), "JPY-TIBOR-EUROYEN-3M");
        }
Ejemplo n.º 19
0
        public virtual void test_euribor3m()
        {
            IborIndex test = IborIndex.of("EUR-EURIBOR-3M");

            assertEquals(test.Currency, EUR);
            assertEquals(test.Name, "EUR-EURIBOR-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, EUTA);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, EUTA));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(2, EUTA));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.ofLastBusinessDay(TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, EUTA)));
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.DefaultFixedLegDayCount, THIRTY_U_360);
            assertEquals(test.FloatingRateName, FloatingRateName.of("EUR-EURIBOR"));
            assertEquals(test.ToString(), "EUR-EURIBOR-3M");
        }
Ejemplo n.º 20
0
        //-------------------------------------------------------------------------
        public virtual void test_usdLibor3m()
        {
            IborIndex test = IborIndex.of("USD-LIBOR-3M");

            assertEquals(test.Currency, USD);
            assertEquals(test.Name, "USD-LIBOR-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, GBLO);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, GBLO));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(2, GBLO, BusinessDayAdjustment.of(FOLLOWING, GBLO.combinedWith(USNY))));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.ofLastBusinessDay(TENOR_3M, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO.combinedWith(USNY))));
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.DefaultFixedLegDayCount, ACT_360);
            assertEquals(test.FloatingRateName, FloatingRateName.of("USD-LIBOR"));
            assertEquals(test.ToString(), "USD-LIBOR-3M");
        }
Ejemplo n.º 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "businessDayAdjustment") public void test_businessDayAdjustment(ImmutableCdsConvention convention, com.opengamma.strata.basics.date.BusinessDayAdjustment adj)
        public virtual void test_businessDayAdjustment(ImmutableCdsConvention convention, BusinessDayAdjustment adj)
        {
            assertEquals(convention.BusinessDayAdjustment, adj);
            assertEquals(convention.StartDateBusinessDayAdjustment, adj);
            assertEquals(convention.EndDateBusinessDayAdjustment, BusinessDayAdjustment.NONE);
        }
Ejemplo n.º 22
0
        public virtual void formatForCsv()
        {
            AdjustableDate date = AdjustableDate.of(date(2016, 6, 30), BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN));

            assertThat(AdjustableDateValueFormatter.INSTANCE.formatForCsv(date)).isEqualTo("2016-06-30");
        }
Ejemplo n.º 23
0
        public virtual void test_mxn_tiie()
        {
            IborIndex test = IborIndex.of("MXN-TIIE-4W");

            assertEquals(test.Currency, MXN);
            assertEquals(test.Name, "MXN-TIIE-4W");
            assertEquals(test.Tenor, TENOR_4W);
            assertEquals(test.FixingCalendar, MXMC);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-1, MXMC));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(1, MXMC));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_4W, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(FOLLOWING, MXMC)));
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.DefaultFixedLegDayCount, ACT_360);
            assertEquals(test.ToString(), "MXN-TIIE-4W");
        }
Ejemplo n.º 24
0
        public virtual void test_sek_stibor()
        {
            IborIndex test = IborIndex.of("SEK-STIBOR-3M");

            assertEquals(test.Currency, SEK);
            assertEquals(test.Name, "SEK-STIBOR-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, SEST);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, SEST));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(2, SEST));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_3M, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SEST)));
            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.DefaultFixedLegDayCount, THIRTY_U_360);
            assertEquals(test.ToString(), "SEK-STIBOR-3M");
        }
Ejemplo n.º 25
0
        public virtual void test_pln_wibor()
        {
            IborIndex test = IborIndex.of("PLN-WIBOR-3M");

            assertEquals(test.Currency, PLN);
            assertEquals(test.Name, "PLN-WIBOR-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, PLWA);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, PLWA));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(2, PLWA));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_3M, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, PLWA)));
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.DefaultFixedLegDayCount, ACT_ACT_ISDA);
            assertEquals(test.ToString(), "PLN-WIBOR-3M");
        }
        public virtual void test_serialization()
        {
            ResetSchedule test = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();

            assertSerialization(test);
        }
Ejemplo n.º 27
0
        public virtual void test_sgd_sibor()
        {
            HolidayCalendarId SGSI = HolidayCalendarId.of("SGSI");
            IborIndex         test = IborIndex.of("SGD-SIBOR-3M");

            assertEquals(test.Currency, SGD);
            assertEquals(test.Name, "SGD-SIBOR-3M");
            assertEquals(test.Tenor, TENOR_3M);
            assertEquals(test.FixingCalendar, SGSI);
            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, SGSI));
            assertEquals(test.EffectiveDateOffset, DaysAdjustment.ofBusinessDays(2, SGSI));
            assertEquals(test.MaturityDateOffset, TenorAdjustment.of(TENOR_3M, PeriodAdditionConventions.NONE, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SGSI)));
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.DefaultFixedLegDayCount, ACT_365F);
            assertEquals(test.ToString(), "SGD-SIBOR-3M");
        }
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            ResetSchedule  test          = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();
            SchedulePeriod accrualPeriod = SchedulePeriod.of(DATE_01_06, DATE_04_07, DATE_01_05, DATE_04_05);
            Schedule       schedule      = test.createSchedule(DAY_5, REF_DATA).apply(accrualPeriod);
            Schedule       expected      = Schedule.builder().periods(SchedulePeriod.of(DATE_01_06, DATE_02_05, DATE_01_05, DATE_02_05), SchedulePeriod.of(DATE_02_05, DATE_03_05, DATE_02_05, DATE_03_05), SchedulePeriod.of(DATE_03_05, DATE_04_07, DATE_03_05, DATE_04_05)).frequency(P1M).rollConvention(DAY_5).build();

            assertEquals(schedule, expected);
        }
 // Create a zero-coupon fixed leg convention
 private static FixedRateSwapLegConvention fixedLegZcConvention(Currency ccy, HolidayCalendarId cal)
 {
     return(FixedRateSwapLegConvention.builder().paymentFrequency(Frequency.TERM).accrualFrequency(Frequency.P12M).accrualBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, cal)).startDateBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, cal)).endDateBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, cal)).compoundingMethod(CompoundingMethod.STRAIGHT).dayCount(ONE_ONE).currency(ccy).build());
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ResetSchedule test = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();

            coverImmutableBean(test);
            ResetSchedule test2 = ResetSchedule.builder().resetFrequency(P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO)).resetMethod(WEIGHTED).build();

            coverBeanEquals(test, test2);
        }