// Set up converter (could this be compiled?)
final HolidaySource holidaySource = OpenGammaExecutionContext.getHolidaySource(executionContext);
final ISDACDSSecurityConverter converter = new ISDACDSSecurityConverter(holidaySource);
// Security being priced
final CDSSecurity cds = (CDSSecurity) target.getSecurity();
final ISDACDSDefinition cdsDefinition = (ISDACDSDefinition) cds.accept(converter);
// Time point to price for
// TODO: Supply an option for the user to specify non-standard step-in and settlement dates
final ZonedDateTime pricingDate = ZonedDateTime.now(executionContext.getValuationClock());
final ZonedDateTime stepinDate = pricingDate.plusDays(1);
final ZonedDateTime settlementDate = findSettlementDate(pricingDate, cdsDefinition.getConvention());
// Discount curve
final ISDACurve discountCurve = (ISDACurve) inputs.getValue(new ValueRequirement(
ValueRequirementNames.YIELD_CURVE, ComputationTargetSpecification.of(cds.getCurrency()),
ValueProperties.with(ValuePropertyNames.CALCULATION_METHOD, ISDAFunctionConstants.ISDA_METHOD_NAME).get()));
// Hazard rate curve
final ISDACurve hazardRateCurve = (ISDACurve) inputs.getValue(new ValueRequirement(
ValueRequirementNames.YIELD_CURVE, ComputationTargetSpecification.of(cds.getCurrency()),
ValueProperties
.with(ValuePropertyNames.CURVE, "HAZARD_" + cds.getUnderlyingIssuer() + "_" + cds.getUnderlyingSeniority() + "_" + cds.getRestructuringClause())
.with(ValuePropertyNames.CALCULATION_METHOD, ISDAFunctionConstants.ISDA_METHOD_NAME)
.get()));
// Convert security in to format suitable for pricing
final ISDACDSDerivative cdsDerivative = cdsDefinition.toDerivative(pricingDate, stepinDate, settlementDate, discountCurve.getName(), hazardRateCurve.getName());