Bonds
|
06-01-2015, 09:20 AM
(This post was last modified: 06-01-2015 04:22 PM by salvomic.)
Post: #1
|
|||
|
|||
Bonds
hi,
I would present a program useful to calculate price and yield of a Bond. The program treat Bonds with coupons paid annually or semi-annually (or other ends) and also "Zero bonds", both for "actual year" and "financial year" (30/360). For some examples see HP 12C User Guide or here. Some examples may differ from the calculations made by HP 12C but always below 0.1, due to different rounding for the numbers... Enjoy and let me know if you have further improvement. Salvo M. Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
08-20-2017, 09:40 PM
Post: #2
|
|||
|
|||
RE: Bonds
Salvo-
I am a new Prime user and an occasional buyer of US municipal bonds. I have a few questions: From section 4 page 82 of the HP12C manual the examples are: Treasury Bonds (actual/actual) semi annual payments 28 April 2004 settle date 04 June 2018 mature date 6.75% coupon 4.75% desired yield at maturity ? what is the bond price HP 12C answer: 120.38 123.07 (bond price + accrued interest) Salvo Prime answer: 120.28 2.69 accrued interest = 122.97 (bond price + accrued interest) Bond Yield Example: 28 April 2004 settle date 04 June 2018 mature date 6.75% coupon 122.125 = price what is yield? answer: hp12c yield = 4.60 Salvo Prime answer = 4.59 Section 16 Page 175 has an hp12c program for 30/360 bonds such as municipal bonds. In using your program I understand that checking the financial box causes 30/360 calculations. Example: 28 August 2004 settle date 01 June 2008 mature date 5.5% coupon desired yield = 4.75 what is the bond price? hp12c answer: 102.55 accrued interest 1.33 Salvo Prime answer: 102.703 accrued interest 1.375 desired yield = 4.50 what is the bond price? hp12c answer: 103.41 accrued interest 1.33 Salvo Prime answer: 103.62 accrued interest 1.375 Your writeup says your answers are within .1 of the hp12c manual. Except for the example directly above (102.55 versus 102.70 and 103.41 versus 103.62) that is the case. From the examples have I used your program correctly? If the financial box is checked are bond calculations made on a 30/360 basis? Read your bio on qrz. Thanks Randy WA0RAD |
|||
08-21-2017, 09:48 AM
(This post was last modified: 08-21-2017 03:16 PM by salvomic.)
Post: #3
|
|||
|
|||
RE: Bonds
dear Randal,
thank you for your report. You're right, there are some (and not good) approximations in my program. I made it in 2015 and it seemed to work well then, but now I can see your observed differences. I don't know if the problem stay in the new firmware or in my formulas. For example the use of solve() function like this code: Code: C:= coupon; A:= ann; Y:= years; P:= price; I hope someone could be so kind to help us to find the bug. 73, regards salvo it9clu EDIT (PS): maybe sometime HP could implement such function inside the standard APPs in the Prime. I'm looking forward :-) ;-) ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)