|
On 08/22/2005 09:59:51 AM, Kim, Hyung Geun wrote:
> Could someone show me simple example about how to use
> [InterpolatedDiscountCurve] ?
Let's say you have a series of discount factors such as these:
maturity discount
1 year 0.99
2 years 0.97
5 years 0.92
10 years 0.85
You can use it as follows:
std::vector<Date> dates;
std::vector<DiscountFactor> discounts;
// add settlement date and corresponding discount
dates.push_back(settlement);
discount.push_back(1.0);
// add other dates
dates.push_back(calendar.advance(settlement,1,Years));
discount.push_back(0.99);
dates.push_back(calendar.advance(settlement,2,Years));
discount.push_back(0.97);
...
// instantiate the curve
boost::shared_ptr<TermStructure> curve(
new InterpolatedDiscountCurve<LogLinear>(dates,discounts,
Actual360()));
You can replace LogLinear with Linear, Cubic... see the ql/Math folder
for available interpolations.
Later,
Luigi
----------------------------------------
Westheimer's Discovery:
A couple of months in the laboratory can frequently save a
couple of hours in the library.
|