Re: How to calculate bond yield

Posted by Guowen Han on
URL: http://quantlib.414.s1.nabble.com/How-to-calculate-bond-yield-tp786p790.html


Looks like the term structure is missing.  ZeroCouponBond use default term structure which is null I guess.

Guowen


"Enrico Gargiulo" <[hidden email]>
Sent by: [hidden email]

04/19/2007 11:06 AM

To
"'Luigi Ballabio'" <[hidden email]>
cc
[hidden email]
Subject
Re: [Quantlib-users] How to calculate bond yield






Enrico,
                the discount curve is only used if you want to calculate a
theoretical price based on such curve. For price/yield calculations, you
don't need to provide one---the yield will be used for discounting instead.

Later,
                Luigi


----------------------------------------

Green's Law of Debate:
Anything is possible if you don't know what you're talking about.


Luigi,
my problem is that when I create the object without curve I have the
following results:

       Real faceAmount = 98.0;
       Date issueDate(30, April, 2006);
       Date maturityDate(30, April, 2007);
       Date deliveryDate(18, April, 2007);
       Integer settlementDays = 3;
       Calendar calendar = NullCalendar();
       DayCounter dayCountConvention = Actual365Fixed();
       BusinessDayConvention businessDayConvention = Unadjusted;
       Real redemption = 100.0;
       
       Date settlementDate(18, April, 2007);
       
       ZeroCouponBond bot(faceAmount, issueDate, maturityDate,
settlementDays,
           dayCountConvention, calendar, businessDayConvention,
redemption);
           
           
       std::cout << "Underlying bond clean price: " << bot.cleanPrice() <<
std::endl;

The results are:

                Underlying bond clean price: no discounting term structure set

Where is the mistake?

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


________________________________________________________
DTCC DISCLAIMER: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please notify us immediately and delete the email and any attachments from your system. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

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