final LegacyVanillaCreditDefaultSwapDefinition valuationCDS = cds;
// ----------------------------------------------------------------------------------------------------------------------------------------
// Call the constructor to create a CDS present value object
final PresentValueLegacyCreditDefaultSwap creditDefaultSwap = new PresentValueLegacyCreditDefaultSwap();
// Call the constructor to create a calibrate hazard rate curve object
final CalibrateHazardRateCurveLegacyCreditDefaultSwap hazardRateCurve = new CalibrateHazardRateCurveLegacyCreditDefaultSwap();
// ----------------------------------------------------------------------------------------------------------------------------------------
final double[] calibratedHazardRates = hazardRateCurve.getCalibratedHazardRateTermStructure(valuationDate, calibrationCDS, marketTenors, marketSpreads, yieldCurve, PriceType.CLEAN);
final double[] modifiedHazardRateCurve = new double[1];
modifiedHazardRateCurve[0] = calibratedHazardRates[0];
// Build a hazard rate curve object based on the input market data
final HazardRateCurve calibratedHazardRateCurve = new HazardRateCurve(marketTenors, times, modifiedHazardRateCurve/*calibratedHazardRates*/, 0.0);
// Calculate the points upfront
final double pointsUpfront = creditDefaultSwap.getPresentValueLegacyCreditDefaultSwap(valuationDate, valuationCDS, yieldCurve, calibratedHazardRateCurve, priceType);
// ----------------------------------------------------------------------------------------------------------------------------------------
return pointsUpfront / cds.getNotional();
}