InterpolatedZeroCurve -- > Understanding Problem
Posted by d0tc0mguy on
URL: http://quantlib.414.s1.nabble.com/InterpolatedZeroCurve-Understanding-Problem-tp5353.html
I am newbie to the Quantlib library and I'm trying to understand the way yield curve function in the Quantlib.
I am using the interpolatedzerocurve interface
Code Snippet follows :
// Calendar calendar = TARGET();
Calendar calendar = NullCalendar();
Date settlementDate(10, March, 2011);
Date Date1(10, March, 2011);
Date Date2(10, March, 2012);
Date Date3(10, March, 2013);
Date Date4(10, March, 2014);
Date Date5(10, March, 2015);
std::vector<Date> dates;
std::vector<Rate> rates;
dates.push_back(Date1);
dates.push_back(Date2);
dates.push_back(Date3);
dates.push_back(Date4);
dates.push_back(Date5);
rates.push_back(0.05);
rates.push_back(0.05);
rates.push_back(0.05);
rates.push_back(0.05);
rates.push_back(0.05);
Handle<YieldTermStructure> bondDiscountingTermStructure(
new InterpolatedZeroCurve<Linear>(dates, rates,termStructureDayCounter));
std::cout<< "Date: " << Date1 << " ZeroRate:" << bondDiscountingTermStructure->zeroRate(bondDiscountingTermStructure->timeFromReference(Date1),Simple,Annual,false) <<std::endl;
std::cout<< "Date: " << Date2 << " ZeroRate:" << bondDiscountingTermStructure->zeroRate(bondDiscountingTermStructure->timeFromReference(Date2),Simple,Annual,false) <<std::endl;
std::cout<< "Date: " << Date3 << " ZeroRate:" << bondDiscountingTermStructure->zeroRate(bondDiscountingTermStructure->timeFromReference(Date3),Simple,Annual,false) <<std::endl;
std::cout<< "Date: " << Date4 << " ZeroRate:" << bondDiscountingTermStructure->zeroRate(bondDiscountingTermStructure->timeFromReference(Date4),Simple,Annual,false) <<std::endl;
std::cout<< "Date: " << Date5 << " ZeroRate:" << bondDiscountingTermStructure->zeroRate(bondDiscountingTermStructure->timeFromReference(Date5),Simple,Annual,false) <<std::endl;
Output -
Date: March 10th, 2011 ZeroRate:5.000013 % Actual/Actual (ISDA) simple compounding
Date: March 10th, 2012 ZeroRate:5.127397 % Actual/Actual (ISDA) simple compounding
Date: March 10th, 2013 ZeroRate:5.258546 % Actual/Actual (ISDA) simple compounding
Date: March 10th, 2014 ZeroRate:5.394475 % Actual/Actual (ISDA) simple compounding
Date: March 10th, 2015 ZeroRate:5.535069 % Actual/Actual (ISDA) simple compounding
I am not able to understand why the a flat zero rate curve with 5%, when interpolated returns - 5.12%, 5.25%, 5.39% ....
Thanks in advance,
Das