TermStructure - parRate method

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

TermStructure - parRate method

kwerle

What does the parRate method on the TermStructure object do?  I'm creating
a
zeroCurve and the zeroRates I get back make sense.  I'm not sure I
understand what the parRates method is trying to return and the values
returned don't make sense.  I'm also getting back different values when I
use the overloaded versions of the parRate method.  Any help would be
greatly appreciated.

Thanks, Kevin

Sample Program ...
#include "stdafx.h"
#include <iostream>
#include <cmath>

#include <ql/quantlib.hpp>
using namespace QuantLib;

int main(int argc, char* argv[])
{
 Date settle = Date::todaysDate();
 Date d;
 DayCounter dayCounter = ActualActual();

 Period p(1,Months);
 Rate v = log(1.05);

 std::vector<Date> dates;
 std::vector<Rate> rates;
 dates.push_back(settle);
 rates.push_back(v);
 d = settle;
 d+=(12 * p);
 dates.push_back(d);
 rates.push_back(v);
 d+=(48 * p);
 dates.push_back(d);
 rates.push_back(v);

 ZeroCurve curve(dates,rates,dayCounter);

 d = settle;
 InterestRate r =
curve.zeroRate(settle,curve.dayCounter(),Compounded,Semiannual);
 std::cout << "[zero] " << d << " :: " << r << std::endl;

 d+=(12 * p);
 r = curve.zeroRate(d,curve.dayCounter(),Compounded,Semiannual);
 std::cout << "[zero] " << d << " :: " << r << std::endl;

 d+=(48 * p);
 r = curve.zeroRate(d,curve.dayCounter(),Compounded,Semiannual);
 std::cout << "[zero] " << d << " :: " << r << std::endl;

 // using tenor version
 v = curve.parRate(1,settle,Semiannual);
 d = settle + (12 * p);
 std::cout << "[par] " << settle << " :: " << v << std::endl;

 // using explicit dates version
 dates.clear;
 dates.push_back(settle);
 d = settle + (1 * Years);
 dates.push_back(d);
 v = curve.parRate(dates,Semiannual);
 std::cout << "[par] " << d << " :: " << v << std::endl;

 return 0;
}


Output ...
[zero] 01/23/2007 :: 4.939015 % Actual/Actual (ISDA) semiannual compounding
[zero] 01/23/2008 :: 4.939015 % Actual/Actual (ISDA) semiannual compounding
[zero] 01/23/2012 :: 4.939015 % Actual/Actual (ISDA) semiannual compounding
[par] 01/23/2007 :: 0.0999831
[par] 01/23/2008 :: 0.0258175


-----------------------------------------
All e-mail sent to or from this address will be received by the
General Re-New England Asset Management, Inc. (GR-NEAM) e-mail
system.  As a result, this e-mail may be archived by GR-NEAM and
may be reviewed by someone other than the sender or recipient.
Subject to that exception, this e-mail, including attachments may
contain confidential and/or legally privileged information and is
intended for the named person/company.  Unauthorized disclosure,
copying or use of this information may be unlawful and is
prohibited.  If you are not the intended recipient, please delete
this message and notify the sender.