예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Multiple entries with same key: .*") public void test_single_curve_multiple_Files()
        public virtual void test_single_curve_multiple_Files()
        {
            RatesCalibrationCsvLoader.load(ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CALIBRATION_1), ResourceLocator.of(CALIBRATION_1)));
        }
        public virtual void test_load_curves_date_filtering()
        {
            IList <RatesCurveGroup> curves = RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2), ResourceLocator.of(CURVES_3)));

            assertCurves(curves);
        }
        public virtual void test_writer_curve_nodes()
        {
            IList <RatesCurveGroup> curveGroups = RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
            Appendable underlying = new StringBuilder();

            RatesCurvesCsvLoader.writeCurveNodes(underlying, CURVE_DATE, curveGroups[0]);
            string created  = underlying.ToString();
            string expected = "Valuation Date,Curve Name,Date,Value,Label" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2009-11-06,0.001763775,3M" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2010-02-08,0.002187884,6M" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2010-08-06,0.004437206,1Y" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2011-08-08,0.011476741,2Y" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2012-08-08,0.017859057,3Y" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2014-08-06,0.026257102,5Y" + Environment.NewLine +
                              "2009-07-31,USD-Disc,2019-08-07,0.035521988,10Y" + Environment.NewLine +
                              "2009-07-31,USD-3ML,2009-11-04,0.007596889,3M" + Environment.NewLine +
                              "2009-07-31,USD-3ML,2010-08-04,0.008091541,1Y" + Environment.NewLine +
                              "2009-07-31,USD-3ML,2011-08-04,0.015244398,2Y" + Environment.NewLine +
                              "2009-07-31,USD-3ML,2012-08-06,0.021598026,3Y" + Environment.NewLine +
                              "2009-07-31,USD-3ML,2014-08-05,0.029984216,5Y" + Environment.NewLine +
                              "2009-07-31,USD-3ML,2019-08-06,0.039245812,10Y" + Environment.NewLine;

            assertEquals(created, expected);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Rates curve loader found multiple curves with the same name: .*") public void test_single_curve_multiple_Files()
        public virtual void test_single_curve_multiple_Files()
        {
            RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_1)));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_invalid_curve_duplicate_points()
        public virtual void test_invalid_curve_duplicate_points()
        {
            RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_INVALID_DUPLICATE_POINTS)));
        }
예제 #6
0
        public virtual void test_loadAllDates()
        {
            LocalDate sampleDate = ALL_DATES[3];     // 2017-04-21
            ImmutableList <LocalDate> expDates  = ImmutableList.of(LocalDate.of(2017, 0x7, 21), LocalDate.of(2017, 10, 0x7), LocalDate.of(2018, 4, 13), LocalDate.of(2019, 4, 12), LocalDate.of(2020, 3, 20), LocalDate.of(2021, 3, 19), LocalDate.of(2022, 3, 19), LocalDate.of(2023, 3, 17), LocalDate.of(2024, 6, 17), LocalDate.of(2025, 3, 18), LocalDate.of(2026, 3, 20), LocalDate.of(2027, 3, 20), LocalDate.of(2031, 12, 19), LocalDate.of(2037, 3, 17), LocalDate.of(2047, 3, 17), LocalDate.of(2056, 3, 17));
            ImmutableList <string>    expTenors = ImmutableList.of("3M", "6M", "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "15Y", "20Y", "30Y", "40Y");
            RepoGroup   repoGroup      = RepoGroup.of("JP-REPO");
            DoubleArray expRepoXValues = DoubleArray.of(3, n => ACT_365F.relativeYearFraction(sampleDate, expDates.get(n)));
            DoubleArray expRepoYValues = DoubleArray.of(-0.0019521, -0.0016021, -0.0022521);
            ImmutableList <LabelDateParameterMetadata> expRepoMetadata = IntStream.range(0, 3).mapToObj(n => LabelDateParameterMetadata.of(expDates.get(n), expTenors.get(n))).collect(Guavate.toImmutableList());
            LegalEntityGroup legalEntityGroup = LegalEntityGroup.of("JP-GOVT");
            DoubleArray      expIssuerXValues = DoubleArray.of(expDates.size(), n => ACT_365F.relativeYearFraction(sampleDate, expDates.get(n)));
            DoubleArray      expIssuerYValues = DoubleArray.of(-0.0019511690511744527, -0.001497422302092893, -0.0021798583657932176, -0.002215700360912938, -0.0021722324679574866, -0.001922059591219172, -0.0015461646763548528, -0.0014835851245462084, -0.001118669580570464, -5.476767138782941E-4, -2.2155596172855965E-4, 2.0333291172821893E-5, 0.00284500423293463, 0.005876533417933958, 0.007957581583531789, 0.009134630405512047);
            ImmutableList <LabelDateParameterMetadata> expIssuerMetadata = IntStream.range(0, expDates.size()).mapToObj(n => LabelDateParameterMetadata.of(expDates.get(n), expTenors.get(n))).collect(Guavate.toImmutableList());

            ImmutableListMultimap <LocalDate, LegalEntityCurveGroup> allCurves = LegalEntityRatesCurvesCsvLoader.loadAllDates(ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));

//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the java.util.Collection 'containsAll' method:
            assertTrue(allCurves.Keys.containsAll(ALL_DATES));
            ImmutableList <LegalEntityCurveGroup> groups = allCurves.get(sampleDate);

            assertEquals(groups.size(), 2);
            // group 0
            LegalEntityCurveGroup group0 = groups.get(0);

            assertEquals(group0.Name, CurveGroupName.of("Default1"));
            // repo
            assertEquals(group0.RepoCurves.size(), 1);
            Curve repoCurve = group0.RepoCurves.get(Pair.of(repoGroup, JPY));
            InterpolatedNodalCurve expectedRepoCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-REPO-1"), ACT_365F, expRepoMetadata), expRepoXValues, expRepoYValues, CurveInterpolators.LINEAR, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);

            assertEquals(repoCurve, expectedRepoCurve);
            // issuer
            assertEquals(group0.IssuerCurves.size(), 2);
            Curve issuerCurve = group0.IssuerCurves.get(Pair.of(legalEntityGroup, JPY));
            InterpolatedNodalCurve expectedIssuerCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-GOVT-1"), ACT_365F, expIssuerMetadata), expIssuerXValues, expIssuerYValues, CurveInterpolators.LINEAR, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);

            assertEquals(issuerCurve, expectedIssuerCurve);
            Curve usIssuerCurve = group0.IssuerCurves.get(Pair.of(LegalEntityGroup.of("US-GOVT"), USD));

            expectedIssuerCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("US-GOVT"), ACT_360, expIssuerMetadata), DoubleArray.of(expDates.size(), n => ACT_360.relativeYearFraction(sampleDate, expDates.get(n))), expIssuerYValues, CurveInterpolators.NATURAL_SPLINE, CurveExtrapolators.FLAT, CurveExtrapolators.FLAT);
            assertEquals(usIssuerCurve, expectedIssuerCurve);
            // group 1
            LegalEntityCurveGroup group1 = groups.get(1);

            assertEquals(group1.Name, CurveGroupName.of("Default2"));
            // repo
            repoCurve         = group1.RepoCurves.get(Pair.of(repoGroup, JPY));
            expectedRepoCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-REPO-2"), ACT_365F, expRepoMetadata), expRepoXValues, expRepoYValues, CurveInterpolators.DOUBLE_QUADRATIC, CurveExtrapolators.LINEAR, CurveExtrapolators.LINEAR);
            assertEquals(repoCurve, expectedRepoCurve);
            // issuer
            assertEquals(group1.IssuerCurves.size(), 1);
            issuerCurve         = group1.IssuerCurves.get(Pair.of(legalEntityGroup, JPY));
            expectedIssuerCurve = InterpolatedNodalCurve.of(Curves.zeroRates(CurveName.of("JP-GOVT-2"), ACT_365F, expIssuerMetadata), expIssuerXValues, expIssuerYValues, CurveInterpolators.DOUBLE_QUADRATIC, CurveExtrapolators.LINEAR, CurveExtrapolators.LINEAR);
            assertEquals(issuerCurve, expectedIssuerCurve);
        }
 private void testGroups(string groupsResource)
 {
     RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(groupsResource), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1)));
 }
예제 #8
0
        public virtual void test_load()
        {
            ImmutableListMultimap <LocalDate, LegalEntityCurveGroup> allCurves = LegalEntityRatesCurvesCsvLoader.loadAllDates(ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));

            foreach (LocalDate date in ALL_DATES)
            {
                ImmutableList <LegalEntityCurveGroup> oneDayCurves = LegalEntityRatesCurvesCsvLoader.load(date, ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
                assertEquals(oneDayCurves, allCurves.get(date));
            }
        }
예제 #9
0
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_setting_invalid_path()
        public virtual void test_setting_invalid_path()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[4], ResourceLocator.of(GROUPS), ResourceLocator.of("classpath:invalid"), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
        public virtual void test_writeCurveGroup()
        {
            IList <RatesCurveGroup> curveGroups = RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
            Appendable underlying = new StringBuilder();

            RatesCurveGroupDefinitionCsvLoader.writeCurveGroup(underlying, curveGroups[0]);
            string created  = underlying.ToString();
            string expected = "Group Name,Curve Type,Reference,Curve Name" + Environment.NewLine +
                              "Default,discount,USD,USD-Disc" + Environment.NewLine +
                              "Default,forward,USD-LIBOR-3M,USD-3ML" + Environment.NewLine;

            assertEquals(created, expected);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_test_writeCurveGroupDefinition_roundtrip() throws Exception
        public virtual void test_test_writeCurveGroupDefinition_roundtrip()
        {
            IList <RatesCurveGroupDefinition> defn = RatesCurveGroupDefinitionCsvLoader.loadCurveGroupDefinitions(ResourceLocator.of(GROUPS_1));
            File tempFile = File.createTempFile("TestCurveGroupLoading", "csv");

            tempFile.deleteOnExit();
            RatesCurveGroupDefinitionCsvLoader.writeCurveGroupDefinition(tempFile, defn[0]);
            assertEquals(RatesCurveGroupDefinitionCsvLoader.loadCurveGroupDefinitions(ResourceLocator.ofFile(tempFile)), defn);
        }
        //-------------------------------------------------------------------------
        public virtual void test_writeCurveGroupDefinition()
        {
            RatesCurveGroupDefinition defn = RatesCurveGroupDefinitionCsvLoader.loadCurveGroupDefinitions(ResourceLocator.of(GROUPS_1))[0];
            Appendable underlying          = new StringBuilder();

            RatesCurveGroupDefinitionCsvLoader.writeCurveGroupDefinition(underlying, defn);
            string created  = underlying.ToString();
            string expected = "Group Name,Curve Type,Reference,Curve Name" + Environment.NewLine +
                              "Default,discount,USD,USD-Disc" + Environment.NewLine +
                              "Default,forward,USD-LIBOR-3M,USD-3ML" + Environment.NewLine +
                              "Default,forward,US-CPI-U,USD-CPI" + Environment.NewLine;

            assertEquals(created, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_loadCurveGroupDefinition()
        {
            IList <RatesCurveGroupDefinition> defns = RatesCurveGroupDefinitionCsvLoader.loadCurveGroupDefinitions(ResourceLocator.of(GROUPS_1));

            assertEquals(defns.Count, 1);
            RatesCurveGroupDefinition defn = defns[0];

            assertEquals(defn.Entries.get(0), RatesCurveGroupEntry.builder().curveName(CurveName.of("USD-Disc")).discountCurrencies(USD).build());
            assertEquals(defn.Entries.get(1), RatesCurveGroupEntry.builder().curveName(CurveName.of("USD-3ML")).indices(USD_LIBOR_3M).build());
        }
예제 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_invalid_curve_duplicate_points()
        public virtual void test_invalid_curve_duplicate_points()
        {
            RatesCalibrationCsvLoader.load(ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CALIBRATION_INVALID_TYPE)));
        }
예제 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Rates curve loader found multiple curves with the same name: .*") public void test_multiple_curves()
        public virtual void test_multiple_curves()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[6], ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
예제 #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Header not found: 'Curve Name'") public void test_invalid_settings_missing_column_file()
        public virtual void test_invalid_settings_missing_column_file()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[6], ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS_MISSING_CURVE_NAME), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
예제 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_invalid_curve_duplicate_points()
        public virtual void test_invalid_curve_duplicate_points()
        {
            LegalEntityRatesCurvesCsvLoader.loadAllDates(ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1_DEUPLICATE_POINTS), ResourceLocator.of(CURVES_2)));
        }
예제 #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "CurveExtrapolator name not found: Cubic") public void test_invalid_settings_right_extrapolator_file()
        public virtual void test_invalid_settings_right_extrapolator_file()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[4], ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS_INVALID_RIGHT), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
 private void testSettings(string settingsResource)
 {
     RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(settingsResource), ImmutableList.of(ResourceLocator.of(CURVES_1)));
 }
예제 #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Unsupported Value Type in curve settings: Forward") public void test_invalid_settings_value_type_file()
        public virtual void test_invalid_settings_value_type_file()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[0], ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS_INVALID_VALUE), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Missing settings for curve: .*") public void test_noSettings()
        public virtual void test_noSettings()
        {
            IList <RatesCurveGroup> curveGroups = RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_EMPTY), ImmutableList.of(ResourceLocator.of(CURVES_1)));

            assertEquals(curveGroups.Count, 1);

            RatesCurveGroup curveGroup = Iterables.getOnlyElement(curveGroups);

            assertUsdDisc(curveGroup.findDiscountCurve(Currency.USD).get());
        }
예제 #22
0
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_missing_groups_file()
        public virtual void test_missing_groups_file()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[6], ResourceLocator.of(GROUPS), ResourceLocator.of("classpath:invalid"), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
        public virtual void test_multiple_curves_multiple_files()
        {
            IList <RatesCurveGroup> curveGroups = RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));

            assertCurves(curveGroups);
        }
예제 #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Unsupported curve type: Forward") public void test_invalid_curve_type()
        public virtual void test_invalid_curve_type()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[6], ResourceLocator.of(GROUPS_INVALID_CURVE_TYPE), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
        }
        //-------------------------------------------------------------------------
        public virtual void test_load_all_curves()
        {
            ListMultimap <LocalDate, RatesCurveGroup> allGroups = RatesCurvesCsvLoader.loadAllDates(ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2), ResourceLocator.of(CURVES_3)));

            assertEquals(allGroups.size(), 2);
            assertCurves(allGroups.get(CURVE_DATE));

            IList <RatesCurveGroup> curves3 = allGroups.get(CURVE_DATE_CURVES_3);

            assertEquals(curves3.Count, 1);
            RatesCurveGroup group = curves3[0];

            // All curve points are set to 0 in test data to ensure these are really different curve instances
            Curve usdDisc = group.findDiscountCurve(Currency.USD).get();
            InterpolatedNodalCurve usdDiscNodal = (InterpolatedNodalCurve)usdDisc;

            assertEquals(usdDiscNodal.Metadata.CurveName, CurveName.of("USD-Disc"));
            assertTrue(usdDiscNodal.YValues.equalZeroWithTolerance(0d));

            Curve usd3ml = group.findForwardCurve(IborIndices.USD_LIBOR_3M).get();
            InterpolatedNodalCurve usd3mlNodal = (InterpolatedNodalCurve)usd3ml;

            assertEquals(usd3mlNodal.Metadata.CurveName, CurveName.of("USD-3ML"));
            assertTrue(usd3mlNodal.YValues.equalZeroWithTolerance(0d));
        }
예제 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Repo curve values .*") public void test_missing_repo_curve()
        public virtual void test_missing_repo_curve()
        {
            LegalEntityRatesCurvesCsvLoader.load(ALL_DATES[5], ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2_REPO_MISSING)));
        }
        //-------------------------------------------------------------------------
        public virtual void test_writer_curve_settings()
        {
            IList <RatesCurveGroup> curveGroups = RatesCurvesCsvLoader.load(CURVE_DATE, ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_1), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));
            Appendable underlying = new StringBuilder();

            RatesCurvesCsvLoader.writeCurveSettings(underlying, curveGroups[0]);
            string created  = underlying.ToString();
            string expected = "Curve Name,Value Type,Day Count,Interpolator,Left Extrapolator,Right Extrapolator" + Environment.NewLine +
                              "USD-Disc,zero,Act/Act ISDA,Linear,Flat,Flat" + Environment.NewLine +
                              "USD-3ML,zero,Act/Act ISDA,Linear,Flat,Flat" + Environment.NewLine;

            assertEquals(created, expected);
        }
예제 #28
0
        public virtual void test_date_outside_range()
        {
            ImmutableList <LegalEntityCurveGroup> result = LegalEntityRatesCurvesCsvLoader.load(LocalDate.of(2017, 1, 24), ResourceLocator.of(GROUPS), ResourceLocator.of(SETTINGS), ImmutableList.of(ResourceLocator.of(CURVES_1), ResourceLocator.of(CURVES_2)));

            assertTrue(result.Empty);
        }
        //-------------------------------------------------------------------------
        public virtual void test_loadSeasonalityDefinition()
        {
            IDictionary <CurveName, SeasonalityDefinition> defns = SeasonalityDefinitionCsvLoader.loadSeasonalityDefinitions(ResourceLocator.of(GROUPS_1));

            assertEquals(defns.Count, 1);
            SeasonalityDefinition defn = defns[CurveName.of("USD-CPI")];

            assertEquals(defn.AdjustmentType, ShiftType.SCALED);
            assertEquals(defn.SeasonalityMonthOnMonth.size(), 12);
        }
예제 #30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Missing settings for curve: .*") public void test_noSettings()
        public virtual void test_noSettings()
        {
            RatesCalibrationCsvLoader.load(ResourceLocator.of(GROUPS_1), ResourceLocator.of(SETTINGS_EMPTY), ResourceLocator.of(CALIBRATION_1));
        }