求出債券的凸性
計算債券的凸性,是更全面預測債券價格變動並衡量投資組合利率風險的重要步驟。
在這個練習中,你要找出一檔 20 年期、每年付 6% 票息、到期殖利率 5%、面額 $100 的美元債券的凸性。
回想凸性的公式:
\( Convexity = \frac{ P(down) \ + \ P(up) \ - \ 2 \times P }{P \ \times \ (\Delta y)^2} \)
numpy_financial 已經替你以 npf 匯入。
本練習屬於課程
使用 Python 進行債券評價與分析
練習說明
- 求出一檔 20 年期、票息 6%、殖利率 5% 的債券價格。
- 以相同債券,在殖利率各上升與下降 1% 的情況下,分別求出價格。
- 計算該債券的凸性並印出結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Find the price of a 20 year bond with 6% coupon and 5% yield
price = ____
# Find the price of the same bond for a 1% higher and 1% lower level of yields
price_up = ____
price_down = ____
# Find the convexity of the bond and print the result
convexity = ____
print("Convexity: ", ____)