零息債與付息債的存續期間
存續期間(duration)是衡量利率風險的指標,適用於任何債券,無論是否支付票息。
在這個練習中,你要計算一檔到期年限為 10 年、面額 100 美元、到期殖利率 3% 的零息債之存續期間,並將其與相同條件但每年支付 3% 票息的債券相比較。numpy_financial 已替你匯入為 npf。
回想存續期間的公式為:
\(Duration = \frac{P(down) \ -\ P(up)}{2\ \times\ P\ \times\ \Delta y}\)
本練習屬於課程
使用 Python 進行債券評價與分析
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Find the price of the zero coupon bond at current yield levels
price = ____
# Find the price of the zero coupon bond at 1% higher yield levels
price_up = ____
# Find the price of the zero coupon bond at 1% lower yield levels
price_down = ____
# Calculate duration using the formula and print result
duration = (____ - ____) / (____ * ____ * ____)
print("Zero Coupon Bond Duration: ", ____)