Hi
all,
I'm a beginner in
using Quantlib.
I need to calculate
yields on some type of bonds, for example: bot, btp, ecc.
Now I've a first
problem creating an object simulating a bot (ZeroCouponBond), I don't know what
type of discount curve to use.
Is there somebody
that can help me?
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 |
On Thu, 2007-04-19 at 15:28 +0200, Enrico Gargiulo wrote:
> I'm a beginner in using Quantlib. > I need to calculate yields on some type of bonds, for example: bot, > btp, ecc. > > Now I've a first problem creating an object simulating a bot > (ZeroCouponBond), I don't know what type of discount curve to use. 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. ------------------------------------------------------------------------- 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 |
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 |
Looks like the term structure is missing. ZeroCouponBond use default term structure which is null I guess. Guowen
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 |
In reply to this post by Enrico Gargiulo
On Thu, 2007-04-19 at 17:06 +0200, Enrico Gargiulo wrote:
> Luigi, > my problem is that when I create the object without curve I have the > following results: > > 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? btp.cleanPrice(), without any arguments, calculates the theoretical price on a given term structure. But I was under the impression that you wanted to calculated the yield given a price, or viceversa. For calculating the yield, you can use btp.yield(price, compounding); (where compounding is the way you compound the yield---most likely you'll use Simple.) For calculating the price, you can use btp.cleanPrice(yield, compounding); Neither of them requires a term structure as far as I recall (and both of them will take and return yields as decimal numbers, i.e., 0.05 for a 5% yield.) Hope this helps, Luigi ---------------------------------------- Do the right thing. It will gratify some people and astonish the rest. -- Mark Twain ------------------------------------------------------------------------- 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 |
Free forum by Nabble | Edit this page |