The Museum of HP Calculators

HP Forum Archive 07

 17Bii - Bond DurationMessage #1 Posted by Brian H on 11 Dec 2001, 4:56 p.m. I don't know if this has been discussed on this message board before, but I am trying to figure out how to calculate Macauly and Modified duration using "solve". Does anybody else know of or have a formula that they have developed on their own calculator that they would like to share?

 Re: 17Bii - Bond DurationMessage #2 Posted by W. Bruce Maguire II on 13 Dec 2001, 12:34 p.m.,in response to message #1 by Brian H Brian: Sorry for the late reply, but I didn't want to contribute when all I could say is "no!" Can you provide the relevant equations/methodology? If so, I'm sure somebody here could help you with your problem. I love programming the 17BII and 19BII, so I would take a whack at it for you if it is not too big a project. If I misunderstood your post, in that you don't know the relevant equations, then unfortunately I can't be of any help there. Bruce.

 Re: 17Bii - Bond DurationMessage #3 Posted by paolo on 13 Dec 2001, 2:12 p.m.,in response to message #2 by W. Bruce Maguire II I guess you are considering a fixed rate bond, so I'll try to explain you how I solved this problem. First what I suggest to you is to set-up a STAT list named, for example CF (cash flows, in which you'll put the single cash flows for each coupon period (annual, semi-annual, ...). The last cash flow should be the last coupon plus the face value of the bond. You can then calculate the bond duration by solving the following related equations: 1. bond price Calculates the bond price for a given yield to maturity or vice-versa. 2. duration Calculates the bond duration for the ytm calculated in equation 1 3. price sensitivity Calculates the price change for a given movement in rates 4. convexity calculates the convexity of the bond specified above 5. exact price sensitivity calculates the exact price change, using the convexity adjustment for the bond durtation calculated in equation 3. If you want I can e-mail the program codes. By

 Bond Duration ExampleMessage #4 Posted by Gene on 13 Dec 2001, 3:34 p.m.,in response to message #2 by W. Bruce Maguire II Duration = [(1 + a) / a] - [(1 + a) + yrs * (i - a)] / [i * [(1 + a) ^yrs - 1] + i] Where: a = yield to maturity i = annual interest (coupon) yrs = the number of years to maturity So, for a bond of 10 years to maturity with a 10% annual coupon presently yielding 8%, the duration is [(1 + 0.1)/ 0.1] - [(1 + 0.1) + 10 x (0.1-0.08)] / [0.1 x [(1+0.1)^10 - 1 ] + 0.1] or [11 - [ 1.1 +0.2] / [0.1 x [1.593742] + 0.1] or [11 - 1.3/(0.2593742)] or 5.9879 years Gene P.S. I'll be in NY, Chicago, and SF the first 3 weeks of February giving time value of money talks for a CFA exam review course, if anyone here is taking it. :-)

 Re: Bond Duration ExampleMessage #5 Posted by Kay on 9 Jan 2002, 6:48 p.m.,in response to message #4 by Gene I'm a CFP student so this equation is of interest to me. I beleive there is at least one, possibly multiple, errors in this post. When I do the calculation using my preprogrammed SOLVE formula on my HP17BII I get 6.9658 (this SOLVE formula gives correct results as per CFP course exams given by the College of Financial Planning). If I'm not mistaken, the substitutions of values into the equation in this post have not been done correctly. According to the substitutions, the variable "a" is .1 or .08 depending on where in the formula you look. Also, the formula should end in "+ a" not "+ i". I'd like to hear back if I am mistaken about my observations since I'm studying this equation for a comprehensive certification exam. Kay

 Re: Bond Duration ExampleMessage #6 Posted by Gene on 10 Jan 2002, 11:55 a.m.,in response to message #5 by Kay http://www.finplan.com/invest/bondduration.asp The link above is where I got the formula. I think I typed it in correctly. Of course, the formula may be wrong on the web page. You are, however, quite right that I substituted the values into the formula incorrectly. My fault! Here is another site with a specific duration calculation example: http://invest-faq.com/articles/bonds-duration.html ```Gene Wright CFA Exam Test Reviewer http://www.amazon.com/exec/obidos/ASIN/1888840196/ http://members.aol.com/hpgene```

 Re: Bond Duration ExampleMessage #7 Posted by Kay on 10 Jan 2002, 6:45 p.m.,in response to message #6 by Gene You did type the formula into your post correctly. I checked out the web site you noted. The formula is wrong there too. I sent them an e-mail to notify them of the mistake. Hopefully they'll fix it. I've double and triple checked this against my CFP student materials and the only way my observation could be wrong is if the student materials are. Thanks, Kay

 Re: Bond Duration ExampleMessage #8 Posted by Michael on 14 Jan 2002, 2:36 p.m.,in response to message #7 by Kay Hi, if anyone of you is still looking for a bond duration formula, I did spend some hours and programmed one myself on my 17bii -- doing it the "old-fashioned" way. It might not be the shortest one, but I think it works. It also uses some built-in formulas. O.K. here it is: (Note: SUM is the built-in sum-function (ALPHA-Menu -> WXYZ -> OTHER -> MORE -> SUM (second from the left))) DURTN=(SUM(I:1:N*F:1:I/F*C%/100/F*SPPV(R%/F:I))+N*SPPV(R%/F:N*F))/(C%/100/F*USPV(R%/F:N*F)+SPPV(R%/F:N*F)) Where C% ... Coupon (e.g. 7) R% ... YTM (e.g. 6) F ... payment frequency (e.g. Semi-annually -> 2, annually -> 1) N ... Years Example: A 3 (N=3) Year semi-annual (F=2) coupon bond with a coupon of 6% (C%=6) and YTM of 7% p.a. (R%=7) has a (macaulay) duration of 2.79 yrs. Hope this it what you are looking for. Michael

 Re: 17Bii - Bond DurationMessage #9 Posted by Kay on 8 Jan 2002, 8:53 p.m.,in response to message #1 by Brian H Here is the formula I have programmed into my HP17BII to solve for modified Duration - I'm a CFP student. DURTN: ((1+(Y x .01) / PYR) / ((Y x .01)/PYR) - (((1+(Y x .01) / PYR) + ((N x PYR) x ((C x .01)/PYR - (Y x .01) / PYR))) / ((C x .01) / PYR x ((1+(Y x .01) / PYR)^(N x PYR) -1) + (Y x .01) / PYR))) / PYR = DURTN where Y is yield to maturity N is number of years to maturity C is coupon PYR is the number of compounding periods per year (1 or 2). Note that all variable values are entered as whole numbers including Y and C. This formula reduces calculating duration on the HP17BII to as few as 11 keystrokes. I don't claim that this is the shortest formula possible...but it works. I also have a formula for bond price change calculations that will calculate either \$ or %. let me know if you are interested in this. Kay

 Re: 17Bii - Bond DurationMessage #10 Posted by Kay on 9 Jan 2002, 6:51 p.m.,in response to message #9 by Kay Correction - my SOLVE equation doesn't calculate modified duration, just plain old duration. My bond price change formula does the "modfied" part. Kay

Go back to the main exhibit hall