public double getValueWithGivenSpreadOverCurve ( double evaluationTime , Curve referenceCurve , double spread , AnalyticModel model ) { double value = 0 ; for ( int periodIndex = 0 ; periodIndex < schedule . getNumberOfPeriods ( ) ; periodIndex ++ ) { double paymentDate = schedule . getPayment ( periodIndex ) ; value += paymentDate > evaluationTime ? getCouponPayment ( periodIndex , model ) * Math . exp ( - spread * paymentDate ) * referenceCurve . getValue ( paymentDate ) : 0.0 ; } double paymentDate = schedule . getPayment ( schedule . getNumberOfPeriods ( ) - 1 ) ; return paymentDate > evaluationTime ? value + Math . exp ( - spread * paymentDate ) * referenceCurve . getValue ( paymentDate ) : 0.0 ; }
Returns the value of the sum of discounted cash flows of the bond where the discounting is done with the given reference curve and an additional spread . This method can be used for optimizer .