Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/How-to-calculate-a-btp-yield-tp1048p1049.html
On Thu, 2007-06-21 at 14:46 +0200, Enrico Gargiulo wrote:
> Date bondMaturityDate(1, July, 2007);
> Real bondCoupon = 0.03375;
> Frequency bondCouponFrequency = Semiannual;
> DayCounter bondDayCountConvention = ActualActual();
> BusinessDayConvention accrual = Unadjusted;
> Real bondRedemption = 100.0;
> ...
> Date sd1(21, June, 2007);
> Real r1 = 100.103;
> ...
> std::cout << "yield: " << std::endl
> << sd1 << " lorda : " << bond->yield(r1, compounding, sd1)
> << " (3,758%)" <<std::endl;
>
> Why, with this r1 parameter (100.103) I got the following error?
>
> root not bracketed: f[0,1] -> [1.053425e-02,2.465218e+00]
Ciao Enrico,
with the parameters you chose, it's not possible to obtain that price,
no matter the yield.
At maturity, you're going to receive 100 + 1.67363. The discounted value
is 101.67363 or less. Subtract the accrued amount (1.58116) and you get
100.09247 or less. Your price is above that figure.
Later,
Luigi
----------------------------------------
Just remember what ol' Jack Burton does when the earth quakes, the
poison arrows fall from the sky, and the pillars of Heaven shake. Yeah,
Jack Burton just looks that big old storm right in the eye and says,
"Give me your best shot. I can take it."
-- Jack Burton, "Big trouble in Little China"
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users