開始使用免費開始

直接比較兩檔債券的凸性

你也可以透過只在某個因素上有所不同的兩檔債券來定價,接著直接計算各自的凸性,以研究該因素對債券凸性的影響。

在這個練習中,你要找出兩檔債券的凸性;兩者都是 5 年期、殖利率 3%、面額 $100 的債券,但第一檔支付 1% 的票息,第二檔支付 10% 的票息。

numpy_financial 已經以 npf 匯入供你使用。

本練習屬於課程

使用 Python 進行債券評價與分析

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Find the price of a 5 year bond with 3% yield and 1% coupon
price_1 = ____

# Shift yields up and down 1% and reprice
price_up_1 = ____
price_down_1 = ____

# Find convexity of the bond and print the result
convexity_1 = ____
print("Low Coupon Bond Convexity: ", ____)
編輯並執行程式碼