Login  Register

Calculating yield to maturity , incorrect answer ? why ?

Posted by johnacandy on Oct 18, 2010; 2:42pm
URL: http://quantlib.414.s1.nabble.com/Calculating-yield-to-maturity-incorrect-answer-why-tp8325.html

I was hoping you folks could help me out , as i dont know peoole who are familiar with quantlib ,I checked an example out and i wrote down a code in VS2010 C++ and boost + quanlib.
I have attached the code in a noted pad unfortunately i am not
getting the required answer , hope you could help me out
 
Now i have the following requirement :

Current Price = 90
Par Value = 100
Coupon Rate = 5 %
Years to maturity = 1

From the above data an online calculator calculates the Yield to maturity to be = 16.667

However the program i wrote gives 1.769. :(  

The code i wrote is attached with this email , i dont know where i am going wrong , could you kindly go through the program and let me know what i am doing wrong , i need to readjust the above mentioned program to display 16.6... something... Hope you could help me out...

I have used the calculator at
http://www.investopedia.com/calculator/AOYTM.aspx
with the values
100
90
5
1
(select Annually)
and it gives 16.67
and thats what i want.
 I have emailed you the code i am using on the notepad file... Plz take some time to go through it. I bet i must have made a very silly mistake...
 Thanks again