Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/no-subject-tp7681p7682.html
On Wed, 2009-07-15 at 12:45 -0700, Kumar Aiyer wrote:
> I'm a newbie to quantlib. Trying to build a 1-mo USD Libor forward
> curve from a swap curve. Here is a skeletal code. Can an expert in the
> list take a quick look and comment if I am doing things correctly.
> I'm trying to build a cublic spline interpolated forward curve and I
> want to output forwardrates for 1-mo Libor.
Apologies for the delay--I was on vacation.
>From a quick look, it seems correct. But at the end, you might want to
replace your loop (and the calls to forwardRate) with:
USDLibor libor1M(OneMonth, forecastingTermStructure);
...
for (i=0; i<mos; i++) {
currentDate = calendar.advance(currentDate,
OneMonth, Following);
Date fixingDate = libor1M->fixingDate(currentDate);
fwdRates[i] = libor1M->fixing(fixingDate);
}
This way, you let the Libor make the call to forwardRate() with all the
correct conventions (rolling, end-of-month, etc.)
Luigi
--
The economy depends about as much on economists as the weather does on
weather forecasters.
-- Jean-Paul Kauffmann
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users