/src/main/java/net/finmath/marketdata/model/cds/CDS.java
value += -upfrontPayment * discountFactor * survivalProbabilityFactor;valueFixedLeg += periodLength * discountFactor * survivalProbabilityFactor;
valueFixedLeg += periodLength * discountFactor * survivalProbabilityFactor;
double valueFixedLeg = 0.0; for(int periodIndex=0; periodIndex < schedule.getNumberOfPeriods(); periodIndex++){ final double paymentDate = schedule.getPayment(periodIndex); 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; <extra_id_0> double previousPaymentDate = 0 ; if(periodIndex>0) { previousPaymentDate = schedule.getPayment(periodIndex-1); } final double previousSurvivalProbabilityFactor = previousPaymentDate > evaluationTime ? survivalProbabilityCurve.getValue(calibratedModelJPM, previousPaymentDate) : 1.0; valueFloatingLeg += (1.0 - recoveryRateCurve.getValue(calibratedModelJPM,paymentDate)) * discountFactor * (previousSurvivalProbabilityFactor- survivalProbabilityFactor);