Coupon Bearing Bond Pricing Using R Code

    Date:

    This post explains how to calculate the price of some complicated coupon-bearing bonds using R code.

    Introduction

    There are pricing formula for coupon bond as well as discount bond which are used among practioners under the market convention.

    Bond Pricing Formula

    From the above formula, denominator

    indicates that if valuation date tval fall on between interest payment dates

    the simple interest rate calculation is applied to the period tval − tni, not continously compounding.

    Bond Pricing Example

    The following table shows the cash flow schedule of coupon bond with in-advance interest payments. From the fact that the number of cash flow starts from 8 to 14, we can find that the recent settled cash flow payment is 6th not 7th. This contract is of in-advance interest payment features. See the accrual begin date and payment date.

    Consider two cases :

    1. valuation date = 7th interest payment date
    2. 7th interet payment date < valuation date < 8th interest payment date

    The maturity date is 2019-07-29 which is 4 more days later than 2019-07-25 (last day in a quarterly basis). Taking this into account, we can draw cash flows time lines for two cases.

    In other words, since maturity date is 2019-07-29, interet for 4 remaining days is paid at 2019-07-25 in advance. Of couse, principal redemption is made at 2019-07-29.

    But for calculation is done for the second case since the second case is more general than the first and the first case is simple to calculate. With these in-advance payment features, the pricing equation for this coupon bond (clean price) at 2018-03-22 is as follows.

    The explanation of pricing process with cash flow timeline and equation above is

    1) Amount in [ ] is the discounted value of all cashflows since 2018/04/26 evaluating at 2018/04/26 (first payment date) not 2018/03/22 (valuation date).

      2) Discount amount in [] with 35/90 quarter simply compouding to 2018/03/22 value (dirty price).

      3) The portion of 35/90 in interest previously paid at 2018/01/26 should be returned to buyer. This is called as accrued interest and reflected to the last term.

      4) Therefore, dirty price + accrued interest is the clean price which is equal to P𝑃.

    It is a market convention that dirty and clean price of in-advance interest payments is the other way around of regular coupon bond with in-arrears interest payment.

    R code for Bond Pricing

    The following R code is implemented using the above formula and specific considerations such as in-advance features, in-between settlement, … etc.

    #=========================================================================#
    # Financial Econometrics & Derivatives, ML/DL using R, Python, Tensorflow 
    # by Sang-Heon Lee 
    #
    # https://shleemodel.blogspot.com 
    #-------------------------------------------------------------------------#
    # Coupon Bond Valuation with in advance interest payment
    #=========================================================================#
     
    graphics.off()  # clear all graphs
    rm(list=ls())   # clear all datasets
     
    #-----------------------------------------------------------------#
    # Specification
    #-----------------------------------------------------------------#
    # valuation date   : 2018-03-22
    # maturity date    : 2019-07-29
    # coupon rate      : annual 6.2%, quarterly coupon with in advance
    # principal amount : Bullet repayment at maturity 
    #-----------------------------------------------------------------#
     
        cpn.rate <- 0.062    # coupon rate
        int.rate <- 0.062    # interest rate
        mat.qrt  <- 6        # # of interest payments
     
        # initialization
        cpn.amt <- 0  # coupon payments
        prn.amt <- 0  # principal amount
        price   <- 0  # bond price
        
        # 2018.04.26's discounted value of coupon payments
        for (t in 0:(mat.qrt-2)) { 
            cpn.amt <- cpn.amt + (cpn.rate/4)*10000/
                                 (1+int.rate/4)^t
        }
        
        # 2018.04.26's discounted value of 
        # 4-day coupon payment at 2019.07.25
        cpn.amt <- cpn.amt + (cpn.rate/4)*(4/93)*10000/
                             (1+int.rate/4)^(mat.qrt-1)
     
        # 2018.04.26's discounted value of 
        #principal amount at 2019.07.29
        prn.amt <- 10000/
                  ((1+(int.rate/4)*(4/93))*(1+int.rate/4)^(mat.qrt-1))
        
        # 2018.04.26's bond price
        price <- cpn.amt + prn.amt
        
        print(paste(" bond price before discounting at pricing date:", price))
     
        #-----------------------------------------------------------------#
        # 2018.03.22's discounted value of all cash flow
        # = present value of all cash flow
        # = bond price at valuation date
        #-----------------------------------------------------------------#
        # present value discounted at pricing date using simple interest 
        #-----------------------------------------------------------------#
        price = price/(1+(int.rate/4)*(35/90))
        
        print(paste("bond price discounting at pricing date using simple interest :", price))
        
        dirty.price      <- round(price,2)
        accrued.interest <- round((10000*int.rate/4)*(35/90),2)
        clean.price      <- round(dirty.price + accrued.interest,2)
     
        print("clean price = dirty price + accrued interest") 
        print(paste(clean.price, "=", price, "+", accrued.interest))

    The result is as follows.

    [1] "price before discounting at pricing date: 10011.47"
    [1] "price discounting at pricing date using simple interest: 9951.49"
    [1] "clean price = dirty price + accrued interest"
    [1] "10011.77 = 9951.4922404715 + 60.28"

    This post has showed the pricing of some complicated coupon bond, not simple regular coupon bond. But the bottom line is to apply simple interest to incomplete accrual period and compound interest to complete accrual period.

    Next time, let’s dive into YTM(Yield to Maturity) and reinvestment risk with EXCEL illustrations and R code.

    Originally posted on SHLee AI Financial Model.

    Disclosure: Interactive Brokers

    Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

    This material is from SHLee AI Financial Model and is being posted with its permission. The views expressed in this material are solely those of the author and/or SHLee AI Financial Model and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

    Go Source

    Chart

    SignUp For Breaking Alerts

    New Graphic

    We respect your email privacy

    Share post:

    Popular

    More like this
    Related

    Investors Scoop Up Trump Trades As 45’s Odds Climb: Oct. 16, 2024

    Your Privacy When you visit any website it may use...

    Automated Trading Systems: Architecture, Protocols, Types of Latency – Part II

    Read about the evolution of trading systems started in...

    Intro to Business Models

    A business model is one of the most important...

    Guidance, Not Current EPS, Is the Key This Season

    Your Privacy When you visit any website it may use...