2003年第3期国债, 发行期为2003年4月17日至4月22日,起息日为4月17日。息票率为3.4%,每半年支付一次 利息(4月17日和10月17日,节假日顺延),2023年4月17日到期。
从2002年3月25日起实施净价报价制度,从2007年12月1日起,银行间市场采用 ActualActual 方式计息。
2013年3月21日该债券的收盘价97.688,行情表显示应计利息为1.450,结算价为99.138,到期收益率为3.83%。
YTM = 3.6764%
faceAmount <- 100
rates <- 0.034
frequency <- 2
maturityDate <- as.Date("2023-04-17")
issueDate <- as.Date("2003-04-17")
effectiveDate <- as.Date("2003-04-17")
settlementDate <- as.Date("2013-03-21")
cleanPrice <- 97.688
lastCouponDate <- as.Date("2012-10-17")
nextCouponDate <- as.Date("2013-04-17")
last2next <- as.numeric(nextCouponDate - lastCouponDate)
last2settle <- as.numeric(settlementDate - lastCouponDate)
settle2next <- as.numeric(nextCouponDate - settlementDate)
ai <- rates * faceAmount/frequency * last2settle/last2next
dirtyPrice <- cleanPrice + ai
# there are 21 coupon payments from 20130417 to 20230417
t0 <- settle2next/last2next
tt <- t0 + 0:20
A <- faceAmount * rates/frequency
yld <- function(y) sum(A/(1 + y/frequency)^tt) + faceAmount/(1 + y/frequency)^tt[21] -
dirtyPrice
YTM <- uniroot(f = yld, interval = c(0, 0.06), tol = 1e-08)$root
ai
[1] 1.448
dirtyPrice
[1] 99.14
YTM
[1] 0.03676
require("RQuantLib")
# settlementDays: 1 for T+1, 2 for T+2 period: frequency of events, 1 for
# once, 2 for Annual, 3 for Semiannual, 5 for Quarterly
# businessDayConvention, convention used to adjust a date in case it is
# not a valid business day 0 for Following, 2 for Preceding dayCounter, 0
# for Actual360(), 1 for Actual365Fixed(), 2 for ActualActual() compound,
# 0 for Simple, 1 for Compounded, 2 for Continuous
# FixedRateBondPriceByYield(settlementDays = 1, yield, faceAmount,
# effectiveDate, maturityDate, period, calendar = 'us', rates, dayCounter
# = 2, businessDayConvention = 0, compound = 0, redemption = 100,
# issueDate) FixedRateBondYield() change 'yield' to 'price'
setEvaluationDate(settlementDate)
FixedRateBondYield(settlementDays = 0, price = cleanPrice, faceAmount = faceAmount,
effectiveDate = effectiveDate, maturityDate = maturityDate, issueDate = issueDate,
period = 3, rates = rates, dayCounter = 2)
## [1] 0.03676
## attr(,"class")
## [1] "FixedRateBondYield"
无论使用 Excel 还是 R, 所得到期收益率结果一致,但与行情表显示结果有很大的出入。如果有人告知原因, 请给我发邮件:rhozhanghz@gmail.com,谢谢。