|
代码:Function secondDur(restTime, couponRate, YTM, frequency) If frequency <= 1 Then For t = (restTime - Int(restTime)) To restTime If t < restTime Then secondDur = couponRate * t * 100 * (t + 1) _ / (1 + YTM) ^ (t + 2) + secondDur Else secondDur = (couponRate + 1) * 100 * t * (t + 1) _ / (1 + YTM) ^ (t + 2) + secondDur End If secondDur = secondDur Next t Else For t = (restTime * frequency - Int(restTime * frequency)) To (restTime * frequency) If t < (restTime * frequency) Then secondDur = couponRate / frequency * t * 100 * (t + 1) _ / (1 + YTM / frequency) ^ (t + 2) + secondDur Else secondDur = (couponRate / frequency + 1) * 100 * t * (t + 1) _ / (1 + YTM / frequency) ^ (t + 2) + secondDur End If secondDur = secondDur / frequency ^ 2 Next t End If End Function 凸性=secondDur/bondprice,请问高手我上面的程序有什么问题? |
|