我们通常知道某个特定发行人债券的市场价值P,并了解该债券的交易条款即支付情况,例如剩余期限、票息率、支付频率(通常是一年2次)。有了这些数据之后,我们可以计算债券的到期收益率。到期收益率有一个基本的假设,即再投资收益率等于到期收益率。事实上,到期收益率是该债券的即期收益率曲线的某一种平均。必须清楚到期收益率和上一节所提到的平值收益率是不一样的概念。请读者注意区别。
我们将通过VBA求解给定条件下的债券的到期收益率计算函数。首先自定义一个债券定价函数Bond_Clean_Price,这个函数求到的是债券的净价,而后再自定义到期收益率函数YTM,求到的是给定债券及交易价格下对应的到期收益率。
Function Bond_Clean_Price(Face_Value As Double,Coupon_Rate As Double,YTM
As Double,Time_to_Maturity As Double,Pay_Frequency As Integer)
Dim num_period As Double,temp_sum As Double,i As Integer,Bond_Full_Price
As Double,Accrual_Interest As Double
temp_sum=0
num_period=Pay_Frequency*Time_to_Maturity
For i=0To Int(num_period)
temp_sum=temp_sum+(Coupon_Rate×Face_Value/Pay_Frequency)/(1+
YTM/Pay_Frequency)^(i+num_period-Int(num_period))
Next i
Bond_Full_Price=temp_sum+Face_Value/(1+YTM/Pay_Frequency)^num_period
Accrual_Interest=Coupon_Rate×Face_Value/Pay_Frequency*(1-num_
period+Int(num_period))
Bond_Clean_Price=Bond_Full_Price-Accrual_Interest
End Function
= = = = = = = = = = = = = = = = = = = = = = = =
Function YTM(Face_Value As Double,Trading_Price As Double,Coupon_Rate As
Double,Time_to_Maturity As Double,Pay_Frequency As Integer)(www.xing528.com)
Dim yield As Double,left_yield As Double,right_yield As Double,n
As Integer
left_yield=0
right_yield=2
Do
yield=0.5×(left_yield+right_yield)
If Bond_Clean_Price(Face_Value,Coupon_Rate,yield,Time_to_Maturity,Pay
_Frequency)>Trading_Price Then
left_yield=yield
Else
right_yield=yield
End If
Loop While Abs(Bond_Clean_Price(Face_Value,Coupon_Rate,yield,Time_to_
Maturity,Pay_Frequency)-Trading_Price)>0.005
YTM=yield
End Function
图7.2就是利用YTM函数得到的不同债券交易价格(净价)对应的到期收益率计算结果。
图7.2
免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。