Login  Register

How to calculate a btp yield

Posted by Enrico Gargiulo on Jun 21, 2007; 1:46pm
URL: http://quantlib.414.s1.nabble.com/How-to-calculate-a-btp-yield-tp1048.html

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