How to calculate a btp yield

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to calculate a btp yield

Enrico Gargiulo
Hi all,
 
I' ve to calculate the yield of the bond BTP IT0001132098. I writed a c++ function to do this:
 
 
        Date bondIssueDate(1, July, 1997);
        Date bondDatedDate(1, July, 1997);
        Date bondMaturityDate(1, July, 2007);
        Real bondCoupon = 0.03375;
        Frequency bondCouponFrequency = Semiannual;
        Calendar bondCalendar = TARGET();
        DayCounter bondDayCountConvention = ActualActual();
        Integer bondSettlementDays = 2;
        BusinessDayConvention accrual = Unadjusted;
        BusinessDayConvention payment = Following;
        Real bondRedemption = 100.0;
        Real faceAmount = 100.0;
...
        boost::shared_ptr<FixedCouponBond> bond(
                     new FixedCouponBond(faceAmount,
                                         bondIssueDate,
                                         bondDatedDate,
                                         bondMaturityDate,
                                         bondSettlementDays,
                                         std::vector<Rate>(1, bondCoupon),
                                         bondCouponFrequency,
                                         bondCalendar,
                                         bondDayCountConvention,
                                         accrual,
                                         payment,
                                         bondRedemption));
...
        Date sd1(21, June, 2007);
        Real r1 = 100.103;
...
        Compounding compounding = Compounded;
        //Compounding compounding = Simple;
...        
        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]
 
 
Is not possible calculate a bond yield with a price > 100.0?
 
Thanks
Enrico
 

-------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: How to calculate a btp yield

Luigi Ballabio
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