コード例 #1
0
        public virtual void test_presentValueSensitivity()
        {
            PointSensitivityBuilder computed1 = PRICER.presentValueSensitivityRates(CAP_ONE_LEG, RATES, VOLS);
            PointSensitivityBuilder computed2 = PRICER.presentValueSensitivityRates(CAP_TWO_LEGS, RATES, VOLS);
            PointSensitivityBuilder cap       = PRICER_CAP_LEG.presentValueSensitivityRates(CAP_LEG, RATES, VOLS);
            PointSensitivityBuilder pay       = PRICER_PAY_LEG.presentValueSensitivity(PAY_LEG, RATES);

            assertEquals(computed1, cap);
            assertEquals(computed2, cap.combinedWith(pay));
        }
コード例 #2
0
        public virtual void test_presentValueSensitivity()
        {
            PointSensitivities computedWithPayLeg  = PRICER.presentValueSensitivityRates(TRADE_PAYLEG, RATES, VOLS);
            PointSensitivities computedWithPremium = PRICER.presentValueSensitivityRates(TRADE_PREMIUM, RATES, VOLS);
            PointSensitivities pvOneLeg            = PRICER_PRODUCT.presentValueSensitivityRates(CAP_ONE_LEG, RATES, VOLS).build();
            PointSensitivities pvTwoLegs           = PRICER_PRODUCT.presentValueSensitivityRates(CAP_TWO_LEGS, RATES, VOLS).build();
            PointSensitivities pvPrem = PRICER_PREMIUM.presentValueSensitivity(PREMIUM, RATES).build();

            assertEquals(computedWithPayLeg, pvTwoLegs);
            assertEquals(computedWithPremium, pvOneLeg.combinedWith(pvPrem));
        }