static CapitalIndexedBondCurveDataSet()
        {
            DoubleArray   timeIssuer = DoubleArray.of(0.2493150684931507, 0.4986301369863014, 0.9397260273972603, 1.9760386256456322, 4.975342465753425, 9.850355565536344);
            DoubleArray   rateIssuer = DoubleArray.of(6.796425420368682E-5, 3.114315257821455E-4, 7.126179601599612E-4, 0.04946562985220742, 0.01404542200399637, 0.022260846895257275);
            CurveMetadata metaIssuer = Curves.zeroRates(ISSUER_CURVE_NAME, ACT_ACT_ISDA);

            ISSUER_CURVE = InterpolatedNodalCurve.of(metaIssuer, timeIssuer, rateIssuer, INTERPOLATOR);
            DoubleArray   timeRepo = DoubleArray.of(0.0027397260273972603, 0.0136986301369863, 0.1095890410958904, 0.18904109589041096, 0.27123287671232876, 0.5178082191780822, 0.7671232876712328, 1.0191780821917809, 2.025218953514485, 3.0246575342465754, 4.021917808219178, 5.019178082191781, 6.019754472640168, 7.024657534246575, 8.024657534246575, 9.024657534246575, 10.019754472640168);
            DoubleArray   rateRepo = DoubleArray.of(0.0016222186172986138, 0.001622209965572477, 7.547616096755544E-4, 9.003947315389025E-4, 9.833562990057003E-4, 9.300905368344651E-4, 0.0010774349342544426, 0.001209299356175582, 0.003243498783874946, 0.007148138535707508, 0.011417234937364525, 0.015484713638367467, 0.01894872475170524, 0.02177798040124286, 0.024146976832379798, 0.02610320121432829, 0.027814843351943817);
            CurveMetadata metaRepo = Curves.zeroRates(REPO_CURVE_NAME, ACT_ACT_ISDA);

            REPO_CURVE = InterpolatedNodalCurve.of(metaRepo, timeRepo, rateRepo, INTERPOLATOR);
            DoubleArray   timeCpi  = DoubleArray.of(10, 22, 34, 46, 58, 70, 82, 94, 106, 118, 142, 178, 238, 298, 358);
            DoubleArray   valueCpi = DoubleArray.of(242.88404516129032, 248.03712245417105, 252.98128118335094, 258.0416354687366, 263.20242369585515, 268.4653023378886, 273.83617795725064, 279.3124974961296, 284.8987721100803, 290.5954768446179, 302.3336095056465, 320.8351638061777, 354.2203489141063, 391.08797576744865, 431.7913437911175);
            CurveMetadata metaCpi  = Curves.prices("cpiCurve");

            CPI_CURVE = InterpolatedNodalCurve.of(metaCpi, timeCpi, valueCpi, INTERPOLATOR);
            DoubleArray   timeRpi  = DoubleArray.of(10, 22, 34, 46, 58, 70, 82, 94, 106, 118, 142);
            DoubleArray   valueRpi = DoubleArray.of(263.49967737807305, 270.2383424030053, 277.34957060924364, 284.992794643866, 293.2359607153748, 302.0252215004671, 311.3482439082226, 321.10465920118116, 331.44556112285863, 342.4913522908549, 366.076015086898);
            CurveMetadata metaRpi  = Curves.prices("rpiCurve");

            RPI_CURVE = InterpolatedNodalCurve.of(metaRpi, timeRpi, valueRpi, INTERPOLATOR);
            DoubleArray   timeCpij  = DoubleArray.of(10, 22, 34, 46, 58, 70, 82, 94, 106, 118, 142, 178, 238, 298, 358);
            DoubleArray   valueCpij = DoubleArray.of(103.3374833371608, 104.2306743501241, 104.3107880426369, 104.27037709028433, 104.19961127790909, 104.062704760821, 103.89860712110973, 103.73391283682416, 103.78374038315715, 103.83356515845553, 104.18698970060639, 104.72128789312038, 106.46204440686186, 108.231124353441, 110.03241679315009);
            CurveMetadata metaCpij  = Curves.prices("cpijCurve");

            CPIJ_CURVE = InterpolatedNodalCurve.of(metaCpij, timeCpij, valueCpij, INTERPOLATOR);
        }
Esempio n. 2
0
        public virtual void test_of_badCurve()
        {
            CurveMetadata          noDayCountMetadata = DefaultCurveMetadata.builder().curveName(NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.FORWARD_RATE).build();
            InterpolatedNodalCurve notDayCount        = InterpolatedNodalCurve.of(noDayCountMetadata, DoubleArray.of(0, 10), DoubleArray.of(1, 2), INTERPOLATOR);

            assertThrowsIllegalArg(() => SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, notDayCount));
        }
Esempio n. 3
0
        private ImmutableRatesProvider createProvider(double rateStart, double rateStartInterp, double rateEnd, double rateEndInterp)
        {
            LocalDateDoubleTimeSeries timeSeries = LocalDateDoubleTimeSeries.of(VAL_DATE.with(lastDayOfMonth()), 300);
            InterpolatedNodalCurve    curve      = InterpolatedNodalCurve.of(Curves.prices("GB-RPIX"), DoubleArray.of(4, 5, 16, 17), DoubleArray.of(rateStart, rateStartInterp, rateEnd, rateEndInterp), INTERPOLATOR);

            return(ImmutableRatesProvider.builder(VAL_DATE).priceIndexCurve(GB_RPIX, curve).timeSeries(GB_RPIX, timeSeries).build());
        }
Esempio n. 4
0
        static DiscountingKnownAmountPaymentPeriodPricerTest()
        {
            DoubleArray time_gbp = DoubleArray.of(0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0);
            DoubleArray rate_gbp = DoubleArray.of(0.0160, 0.0135, 0.0160, 0.0185, 0.0185, 0.0195, 0.0200, 0.0210);

            DISCOUNT_CURVE_GBP = InterpolatedNodalCurve.of(Curves.zeroRates("GBP-Discount", ACT_ACT_ISDA), time_gbp, rate_gbp, INTERPOLATOR);
        }
Esempio n. 5
0
        static DiscountingTermDepositProductPricerTest()
        {
            CurveInterpolator      interp   = CurveInterpolators.DOUBLE_QUADRATIC;
            DoubleArray            time_eur = DoubleArray.of(0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0);
            DoubleArray            rate_eur = DoubleArray.of(0.0160, 0.0135, 0.0160, 0.0185, 0.0185, 0.0195, 0.0200, 0.0210);
            InterpolatedNodalCurve dscCurve = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-Discount", ACT_360), time_eur, rate_eur, interp);

            IMM_PROV = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).build();
        }
        static DiscountingIborFixingDepositTradePricerTest()
        {
            CurveInterpolator      interp     = CurveInterpolators.DOUBLE_QUADRATIC;
            DoubleArray            time_eur   = DoubleArray.of(0.0, 0.1, 0.25, 0.5, 0.75, 1.0, 2.0);
            DoubleArray            rate_eur   = DoubleArray.of(0.0160, 0.0165, 0.0155, 0.0155, 0.0155, 0.0150, 0.014);
            InterpolatedNodalCurve dscCurve   = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-Discount", ACT_ACT_ISDA), time_eur, rate_eur, interp);
            DoubleArray            time_index = DoubleArray.of(0.0, 0.25, 0.5, 1.0);
            DoubleArray            rate_index = DoubleArray.of(0.0180, 0.0180, 0.0175, 0.0165);
            InterpolatedNodalCurve indexCurve = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-EURIBOR6M", ACT_ACT_ISDA), time_index, rate_index, interp);

            IMM_PROV = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).iborIndexCurve(EUR_EURIBOR_6M, indexCurve).build();
        }
        public virtual void test_periodRatePointSensitivity_onholidaybeforepublication()
        {
            LocalDate lastFixingDate             = LocalDate.of(2017, 6, 30);
            LocalDate gbdBeforeValDate           = LocalDate.of(2017, 7, 3);
            LocalDate gbdAfterValDate            = LocalDate.of(2017, 7, 5);
            double    fixingValue                = 0.0010;
            InterpolatedNodalCurve      curve    = InterpolatedNodalCurve.of(METADATA, DoubleArray.of(-1.0d, 10.0d), DoubleArray.of(0.01, 0.02), INTERPOLATOR);
            ZeroRateDiscountFactors     df       = ZeroRateDiscountFactors.of(USD, LocalDate.of(2017, 7, 4), curve);
            LocalDateDoubleTimeSeries   series   = LocalDateDoubleTimeSeries.builder().put(lastFixingDate, fixingValue).build();
            DiscountOvernightIndexRates test     = DiscountOvernightIndexRates.of(USD_FED_FUND, df, series);
            OvernightIndexObservation   obs      = OvernightIndexObservation.of(USD_FED_FUND, gbdBeforeValDate, REF_DATA);
            OvernightRateSensitivity    expected = OvernightRateSensitivity.ofPeriod(obs, gbdAfterValDate, USD, 1d);

            assertEquals(test.periodRatePointSensitivity(obs, gbdAfterValDate), expected);
        }
Esempio n. 8
0
        static ImmutableRatesProviderSimpleData()
        {
            CurveInterpolator      interp     = CurveInterpolators.DOUBLE_QUADRATIC;
            DoubleArray            time_eur   = DoubleArray.of(0.0, 0.1, 0.25, 0.5, 0.75, 1.0, 2.0);
            DoubleArray            rate_eur   = DoubleArray.of(0.0160, 0.0165, 0.0155, 0.0155, 0.0155, 0.0150, 0.0140);
            InterpolatedNodalCurve dscCurve   = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-Discount", ACT_365F), time_eur, rate_eur, interp);
            DoubleArray            time_index = DoubleArray.of(0.0, 0.25, 0.5, 1.0);
            DoubleArray            rate_index = DoubleArray.of(0.0180, 0.0180, 0.0175, 0.0165);
            InterpolatedNodalCurve indexCurve = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-EURIBOR6M", ACT_365F), time_index, rate_index, interp);

            IMM_PROV_EUR_NOFIX = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).iborIndexCurve(EUR_EURIBOR_6M, indexCurve).build();
            LocalDateDoubleTimeSeries tsE6 = LocalDateDoubleTimeSeries.builder().put(VAL_DATE, 0.012345).build();

            IMM_PROV_EUR_FIX = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).iborIndexCurve(EUR_EURIBOR_6M, indexCurve, tsE6).build();
        }