Example #1
0
        /**
         * The sensitivity of a CDS to the recovery rate. Note this is per unit amount, so the change
         * in PV due to a one percent (say from 40% to 41%) rise is RR will be 0.01 * the returned value.
         *
         * @param cds  the analytic description of a CDS traded at a certain time
         * @param yieldCurve  the yield (or discount) curve
         * @param creditCurve  the credit (or survival) curve
         * @return the recovery rate sensitivity (on a unit notional)
         */
        public double recoveryRateSensitivity(
            CDS cds,
            YieldTermStructure yieldCurve,
            PiecewiseconstantHazardRate creditCurve)
        {
            CDS zeroRR = cds.withRecoveryRate(0);

            return(-_pricer.protectionLeg(zeroRR, yieldCurve, creditCurve));
        }