public virtual void test_createZeroRateSensitivity()
        {
            IssuerCurveZeroRateSensitivity @base    = IssuerCurveZeroRateSensitivity.of(CURRENCY, YEARFRAC, GBP, GROUP, VALUE);
            ZeroRateSensitivity            expected = ZeroRateSensitivity.of(CURRENCY, YEARFRAC, GBP, VALUE);
            ZeroRateSensitivity            test     = @base.createZeroRateSensitivity();

            assertEquals(test, expected);
        }
 /// <summary>
 /// Calculates the curve parameter sensitivity from the point sensitivity.
 /// <para>
 /// This is used to convert a single point sensitivity to curve parameter sensitivity.
 /// The calculation typically involves multiplying the point and unit sensitivities.
 ///
 /// </para>
 /// </summary>
 /// <param name="pointSensitivity">  the point sensitivity to convert </param>
 /// <returns> the parameter sensitivity </returns>
 /// <exception cref="RuntimeException"> if the result cannot be calculated </exception>
 public CurrencyParameterSensitivities parameterSensitivity(IssuerCurveZeroRateSensitivity pointSensitivity)
 {
     return(discountFactors.parameterSensitivity(pointSensitivity.createZeroRateSensitivity()));
 }
Example #3
0
        public virtual void test_curveParameterSensitivity()
        {
            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)).valuationDate(DATE).build();
            LocalDate refDate = date(2018, 11, 24);
            IssuerCurveZeroRateSensitivity sensi1   = test.issuerCurveDiscountFactors(ID_ISSUER, GBP).zeroRatePointSensitivity(refDate, GBP);
            RepoCurveZeroRateSensitivity   sensi2   = test.repoCurveDiscountFactors(ID_SECURITY, ID_ISSUER, GBP).zeroRatePointSensitivity(refDate, GBP);
            PointSensitivities             sensi    = PointSensitivities.of(sensi1, sensi2);
            CurrencyParameterSensitivities computed = test.parameterSensitivity(sensi);
            CurrencyParameterSensitivities expected = DSC_FACTORS_ISSUER.parameterSensitivity(sensi1.createZeroRateSensitivity()).combinedWith(DSC_FACTORS_REPO.parameterSensitivity(sensi2.createZeroRateSensitivity()));

            assertTrue(computed.equalWithTolerance(expected, 1.0e-12));
        }