This function computes the bond price, given the yield to maturity.
bondPrice(buyDate, matDate, rateCoupon, yieldToMat, nPay)
the date at which the bond is bought (settlement date).
maturity date
annual coupon date
yield to maturity
number of coupon payments per day
A list with the following components:
flat price
days since previous coupon payment
days in a coupon period
accrued interest since last coupon payment
invoice price (= flat price + accrued interest)
All the rates are given in decimals.
Bodie, Kane, and Marcus (2014) Investments, 10th Global Edition, McGraw-Hill Education, (see Bond Pricing between Coupon Dates in Section 14.2).
solveYield
# NOT RUN { bondPrice("2012-7-31","2018-7-31",0.0225,0.0079,2) bondPrice("2012-7-31","2018-7-31",0.0225,0.0079,4) bondPrice("2012-7-31","2030-5-15",0.0625,0.02117,2) # }
Run the code above in your browser using DataCamp Workspace