|
From: maria v. <mar...@ya...> - 2008-08-17 01:47:51
|
I am a very experienced programmer in fortran, but I know very little of objected oriented programming.To help me to get started using QuantLib, could someone post or send to me (mar...@ya...) a simple example of yield calculation of a fixed rate coupon bond? I was told to look at the "test suite" but I am so new to all this, including QuantLib, that this advice did not help me much. I need a complete code such as the "ConvertibleBonds.cpp", which comes in the QuantLib package. That is, a code in which I just have to compile and run. Of course, I would also appreciate receiving other examples of code, but the one mentioned above would already be very helpful. Thanks! Maria Vieira |
|
From: Luigi B. <lui...@gm...> - 2008-08-18 19:47:44
|
On Aug 17, 2008, at 3:47 AM, maria vieira wrote: > I am a very experienced programmer in fortran, but I know very > little of objected oriented programming.To help me to get started > using QuantLib, could someone post or send to me > (mar...@ya...) a simple example of yield calculation of a > fixed rate coupon bond? I was told to look at the "test suite" but I > am so new to all this, including QuantLib, that this advice did not > help me much. I need a complete code such as the > "ConvertibleBonds.cpp", which comes in the QuantLib package. That > is, a code in which I just have to compile and run. Of course, I > would also appreciate receiving other examples of code, but the one > mentioned above would already be very helpful. Thanks! A quick note: if anyone wants to write a bond example, post it here--- I'll be happy to include it in next release. Thanks, Luigi P.S. Maria: in the meantime, you can start looking at the file test- suite/bonds.cpp. It cannot be compiled as it is, but chances are that you can can take any of the functions in there, copy it in a separate file, rename it as main() and obtain a running program. (You'll probably have to remove the BOOST_ERROR function calls, too.) |
|
From: Florent G. <flo...@gm...> - 2008-08-19 09:23:51
Attachments:
bond.cpp
|
Today: Wednesday, June 18th, 2008
Settlement date: Friday, June 20th, 2008
ZC Fixed Floating
------------------------------------------------
Net present value 94.24 99.66 101.49
Clean price 94.24 99.18 101.09
Dirty price 94.24 99.66 101.49
Accrued coupon 0.00 0.48 0.40
Previous coupon 0.00 % 4.50 % 5.23 %
Next coupon xxx 4.50 % 2.67 %
Yield 4.22 % 4.60 % 3.64 %
Sample indirect computations (for the floating rate bond):
------------------------------------------------
Yield to Clean Price: 101.08
Clean Price to Yield: 3.63 %
Run completed in 0 s
|
|
From: Luigi B. <lui...@gm...> - 2008-08-19 16:20:21
|
On Tue, 2008-08-19 at 11:23 +0200, Florent Grenier wrote: > I'm currently in the process of writing such a sample (it's almost > over in fact). I'm still having small discrepancies between direct > calculations of the prices and yields, and the results of yield to > price/price to yield computations. I'm going to investigate them as > soon as I have some time. Thanks, Florent. It was sorely missed. I'll look at your code as soon as I get some time. Luigi -- fix, n.,v. What one does when a problem has been reported too many times to be ignored. -- the Jargon file |
|
From: adam99 <ada...@gm...> - 2008-08-25 05:34:15
|
Hi Florent your settlement days are 3, but fixing days are 2. If you make both 3, you will get same results in your floater check Thanks Adam Florent Grenier wrote: > > Dear Luigi, quantlib-users, > > I'm currently in the process of writing such a sample (it's almost over in > fact). I'm still having small discrepancies between direct calculations of > the prices and yields, and the results of yield to price/price to yield > computations. I'm going to investigate them as soon as I have some time. > > By the way I enclosed the code I wrote to this e-mail (as well as the > result > of its execution). It gives a good idea on how Maria could compute the > yield > of her bond. > > If someone has some remarks regarding the quality or the completeness of > my > sample, do not hesitate to tell me. Just to add that my code compiles > against Quantlib 0.9.6 > > Thanks, > Florent > > > > 2008/8/18 Luigi Ballabio <lui...@gm...> > >> >> On Aug 17, 2008, at 3:47 AM, maria vieira wrote: >> > I am a very experienced programmer in fortran, but I know very >> > little of objected oriented programming.To help me to get started >> > using QuantLib, could someone post or send to me >> > (mar...@ya...) a simple example of yield calculation of a >> > fixed rate coupon bond? I was told to look at the "test suite" but I >> > am so new to all this, including QuantLib, that this advice did not >> > help me much. I need a complete code such as the >> > "ConvertibleBonds.cpp", which comes in the QuantLib package. That >> > is, a code in which I just have to compile and run. Of course, I >> > would also appreciate receiving other examples of code, but the one >> > mentioned above would already be very helpful. Thanks! >> >> A quick note: if anyone wants to write a bond example, post it here--- >> I'll be happy to include it in next release. >> >> Thanks, >> Luigi >> >> P.S. Maria: in the meantime, you can start looking at the file test- >> suite/bonds.cpp. >> It cannot be compiled as it is, but chances are that you can can take >> any of the functions in there, copy it in a separate file, rename it >> as main() and obtain a running program. (You'll probably have to >> remove the BOOST_ERROR function calls, too.) >> >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> QuantLib-dev mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-dev >> > > > > Today: Wednesday, June 18th, 2008 > Settlement date: Friday, June 20th, 2008 > > ZC Fixed Floating > ------------------------------------------------ > Net present value 94.24 99.66 101.49 > Clean price 94.24 99.18 101.09 > Dirty price 94.24 99.66 101.49 > Accrued coupon 0.00 0.48 0.40 > Previous coupon 0.00 % 4.50 % 5.23 % > Next coupon xxx 4.50 % 2.67 % > Yield 4.22 % 4.60 % 3.64 % > > Sample indirect computations (for the floating rate bond): > ------------------------------------------------ > Yield to Clean Price: 101.08 > Clean Price to Yield: 3.63 % > > Run completed in 0 s > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > > -- View this message in context: http://www.nabble.com/Could-someone-post-or-e-mail-an-example-of-yield-calculation-of-a-fixed-rate-coupon-bond--tp19016811p19138186.html Sent from the quantlib-dev mailing list archive at Nabble.com. |
|
From: Luigi B. <lui...@gm...> - 2008-08-27 19:45:12
|
On Aug 27, 2008, at 7:21 PM, Florent Grenier wrote: > I send you the corrected code. Florent, I see that you're using a depo-swap curve for forecasting LIBOR fixings and for dscounting. If you have time to do so, and if you think that it makes sense, it might be interesting to use a bond curve for discounting instead; you can build one with a few FixedRateBondHelpers. Other than that, the example looks ok. I'll add it to the library when you think it's finalized. Thanks, Luigi |
|
From: Florent G. <flo...@gm...> - 2008-08-28 09:14:44
|
Hi Luigi, Yes good idea, I'll do it as soon as I can. Just a small question: do you already know when the next release will take place? I would like to bring my modifications to the example before that release. Thanks, Florent 2008/8/27 Luigi Ballabio <lui...@gm...> > > On Aug 27, 2008, at 7:21 PM, Florent Grenier wrote: > >> I send you the corrected code. >> > > Florent, > I see that you're using a depo-swap curve for forecasting LIBOR > fixings and for dscounting. If you have time to do so, and if you think > that it makes sense, it might be interesting to use a bond curve for > discounting instead; you can build one with a few FixedRateBondHelpers. > > Other than that, the example looks ok. I'll add it to the library when you > think it's finalized. > > Thanks, > Luigi > > > |
|
From: Luigi B. <lui...@gm...> - 2008-09-03 20:53:20
|
On Aug 28, 2008, at 11:14 AM, Florent Grenier wrote: > Yes good idea, I'll do it as soon as I can. Just a small question: > do you already know when the next release will take place? I would > like to bring my modifications to the example before that release. I'd like to finalize the release by the end of September (see the mail i just posted to QuantLib-users for details.) Luigi |