DATA_CHECKER.checkSpreadData(valuationDate, marketTenors, marketSpreads);
final int nSpreads = marketSpreads.length;
final double[] bucketedCS01 = new double[nSpreads];
ISDAYieldCurveAndSpreadsProvider calibrationData = new ISDAYieldCurveAndSpreadsProvider(marketTenors, marketSpreads, yieldCurve);
HazardRateCurve hazardRateCurve = HAZARD_RATE_CALCULATOR.calibrateHazardRateCurve(cds, calibrationData, valuationDate);
ISDAYieldCurveAndHazardRateCurveProvider curveProvider = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
final double presentValue = PV_CALCULATOR.getPresentValue(cds, curveProvider, valuationDate, priceType);
// Loop through and bump each of the spreads at each tenor
for (int m = 0; m < nSpreads; m++) {
// Calculate the bumped spreads vector
final double[] bumpedMarketSpreads = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, m, spreadBump, spreadBumpType);
// Calculate the bumped CDS PV
calibrationData = new ISDAYieldCurveAndSpreadsProvider(marketTenors, bumpedMarketSpreads, yieldCurve);
hazardRateCurve = HAZARD_RATE_CALCULATOR.calibrateHazardRateCurve(cds, calibrationData, valuationDate);
curveProvider = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
final double bumpedPresentValue = PV_CALCULATOR.getPresentValue(cds, curveProvider, valuationDate, priceType);
// Compute the CS01 for this tenor
bucketedCS01[m] = (bumpedPresentValue - presentValue) / spreadBump;
}
return bucketedCS01;