//-------------------------------------------------------------------------
        public virtual void test_parSpreadSensitivity()
        {
            PointSensitivities ptsTrade   = PRICER_TRADE.parSpreadSensitivity(RDEPOSIT_TRADE, IMM_PROV);
            PointSensitivities ptsProduct = PRICER_PRODUCT.parSpreadSensitivity(RDEPOSIT_PRODUCT, IMM_PROV);

            assertTrue(ptsTrade.equalWithTolerance(ptsProduct, TOLERANCE_PV_DELTA));
        }
Example #2
0
        //-------------------------------------------------------------------------
        public virtual void test_parSpreadSensitivity_noFixing()
        {
            PointSensitivities             computedNoFix      = PRICER.parSpreadSensitivity(RDEPOSIT, IMM_PROV_NOFIX);
            CurrencyParameterSensitivities sensiComputedNoFix = IMM_PROV_NOFIX.parameterSensitivity(computedNoFix);
            CurrencyParameterSensitivities sensiExpected      = CAL_FD.sensitivity(IMM_PROV_NOFIX, (p) => CurrencyAmount.of(EUR, PRICER.parSpread(RDEPOSIT, (p))));

            assertTrue(sensiComputedNoFix.equalWithTolerance(sensiExpected, TOLERANCE_RATE_DELTA));
            // Par rate and par spread sensitivities are equal
            PointSensitivities             computedParRateNoFix      = PRICER.parRateSensitivity(RDEPOSIT, IMM_PROV_NOFIX);
            CurrencyParameterSensitivities sensiComputedParRateNoFix = IMM_PROV_NOFIX.parameterSensitivity(computedParRateNoFix);

            assertTrue(sensiComputedNoFix.equalWithTolerance(sensiComputedParRateNoFix, TOLERANCE_RATE_DELTA));
            PointSensitivities             computedFix      = PRICER.parSpreadSensitivity(RDEPOSIT, IMM_PROV_FIX);
            CurrencyParameterSensitivities sensiComputedFix = IMM_PROV_NOFIX.parameterSensitivity(computedFix);

            assertTrue(sensiComputedFix.equalWithTolerance(sensiExpected, TOLERANCE_RATE_DELTA));
        }
 /// <summary>
 /// Calculates the par spread curve sensitivity.
 /// </summary>
 /// <param name="trade">  the trade </param>
 /// <param name="provider">  the rates provider </param>
 /// <returns> the par spread curve sensitivity </returns>
 public virtual PointSensitivities parSpreadSensitivity(ResolvedIborFixingDepositTrade trade, RatesProvider provider)
 {
     return(productPricer.parSpreadSensitivity(trade.Product, provider));
 }