Exemplo n.º 1
0
        public virtual void test_zeroRatePointSensitivity_USD()
        {
            RepoCurveDiscountFactors     @base    = RepoCurveDiscountFactors.of(DSC_FACTORS, GROUP);
            RepoCurveZeroRateSensitivity expected = RepoCurveZeroRateSensitivity.of(DSC_FACTORS.zeroRatePointSensitivity(DATE_AFTER, USD), GROUP);
            RepoCurveZeroRateSensitivity computed = @base.zeroRatePointSensitivity(DATE_AFTER, USD);

            assertEquals(computed, expected);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            RepoCurveDiscountFactors test1 = RepoCurveDiscountFactors.of(DSC_FACTORS, GROUP);

            coverImmutableBean(test1);
            RepoCurveDiscountFactors test2 = RepoCurveDiscountFactors.of(ZeroRateDiscountFactors.of(USD, DATE, CURVE), RepoGroup.of("ISSUER2"));

            coverBeanEquals(test1, test2);
        }
Exemplo n.º 3
0
        public virtual void test_parameterSensitivity()
        {
            RepoCurveDiscountFactors       @base    = RepoCurveDiscountFactors.of(DSC_FACTORS, GROUP);
            RepoCurveZeroRateSensitivity   sensi    = @base.zeroRatePointSensitivity(DATE_AFTER, USD);
            CurrencyParameterSensitivities computed = @base.parameterSensitivity(sensi);
            CurrencyParameterSensitivities expected = DSC_FACTORS.parameterSensitivity(DSC_FACTORS.zeroRatePointSensitivity(DATE_AFTER, USD));

            assertEquals(computed, expected);
        }
Exemplo n.º 4
0
        public virtual void test_of()
        {
            RepoCurveDiscountFactors test = RepoCurveDiscountFactors.of(DSC_FACTORS, GROUP);

            assertEquals(test.RepoGroup, GROUP);
            assertEquals(test.Currency, GBP);
            assertEquals(test.ValuationDate, DATE);
            assertEquals(test.discountFactor(DATE_AFTER), DSC_FACTORS.discountFactor(DATE_AFTER));
        }
Exemplo n.º 5
0
        public virtual void test_builder_noValuationDate()
        {
            ImmutableLegalEntityDiscountingProvider test = ImmutableLegalEntityDiscountingProvider.builder().issuerCurves(ImmutableMap.of(Pair.of(GROUP_ISSUER, GBP), DSC_FACTORS_ISSUER)).issuerCurveGroups(ImmutableMap.of(ID_ISSUER, GROUP_ISSUER)).repoCurves(ImmutableMap.of(Pair.of(GROUP_REPO_ISSUER, GBP), DSC_FACTORS_REPO)).repoCurveGroups(ImmutableMap.of(ID_ISSUER, GROUP_REPO_ISSUER)).build();

            assertEquals(test.issuerCurveDiscountFactors(ID_ISSUER, GBP), IssuerCurveDiscountFactors.of(DSC_FACTORS_ISSUER, GROUP_ISSUER));
            assertEquals(test.repoCurveDiscountFactors(ID_SECURITY, ID_ISSUER, GBP), RepoCurveDiscountFactors.of(DSC_FACTORS_REPO, GROUP_REPO_ISSUER));
            assertEquals(test.repoCurveDiscountFactors(ID_ISSUER, GBP), RepoCurveDiscountFactors.of(DSC_FACTORS_REPO, GROUP_REPO_ISSUER));
            assertEquals(test.ValuationDate, DATE);
        }
        // lookup the discount factors for the repo group
        private RepoCurveDiscountFactors repoCurveDiscountFactors(RepoGroup repoGroup, Currency currency)
        {
            DiscountFactors discountFactors = repoCurves.get(Pair.of(repoGroup, currency));

            if (discountFactors == null)
            {
                throw new System.ArgumentException("Unable to find repo curve: " + repoGroup + ", " + currency);
            }
            return(RepoCurveDiscountFactors.of(discountFactors, repoGroup));
        }