/src/main/java/net/finmath/marketdata/model/cds/CDS.java
final Period period=schedule.getPeriod( periodIndex) ;previousPaymentDate = schedule.getPayment( periodIndex-1) ;
previousPaymentDate = schedule.getPayment ( periodIndex-1 ) ;
final double periodLength = schedule.getPeriodLength(periodIndex); final double discountFactor = paymentDate > evaluationTime ? discountCurveInterpolation.getDiscountFactor(calibratedModelJPM, paymentDate) : 0.0; final double survivalProbabilityFactor = paymentDate > evaluationTime ? survivalProbabilityCurve.getValue(calibratedModelJPM, paymentDate) : 0.0; valueFixedLeg += periodLength * discountFactor * survivalProbabilityFactor; double previousPaymentDate = 0 ; if(periodIndex>0) { <extra_id_0> } final double previousSurvivalProbabilityFactor = previousPaymentDate > evaluationTime ? survivalProbabilityCurve.getValue(calibratedModelJPM, previousPaymentDate) : 1.0; valueFloatingLeg += (1.0 - recoveryRateCurve.getValue(calibratedModelJPM,paymentDate)) * discountFactor * (previousSurvivalProbabilityFactor- survivalProbabilityFactor); } final double conventionalSpread = valueFloatingLeg/ valueFixedLeg; return conventionalSpread;