Re: Svensson overshooting when fitting the bond yield curve.
Posted by SteveGe on Sep 30, 2014; 2:42am
URL: http://quantlib.414.s1.nabble.com/Svensson-overshooting-when-fitting-the-bond-yield-curve-tp15926p15929.html
Thanks a lot for your quick reply KK.
I modified the example code in QuantLib-1.4\Examples\FittedBondCurve to use my five bonds and coupons.
Code snippet as below. The parameters I got is very different from yours.
solution_[0] = -0.260551 //this should be your beta1
solution_[1] = 0.249855 //this should be your beta2
solution_[2] = 0.512962 //this should be your beta3
solution_[3] = 0.131457 //this should be your beta4
solution_[4] = 0.0729963 // this might be your 1/lamada1
solution_[5] = 1.56969 // this might be your 1/lamada2
const Size numberOfBonds = 5;
Real cleanPrice[numberOfBonds];
for (Size i=0; i<numberOfBonds; i++) {
cleanPrice[i]=100.0;
}
std::vector< boost::shared_ptr<SimpleQuote> > quote;
for (Size i=0; i<numberOfBonds; i++) {
boost::shared_ptr<SimpleQuote> cp(new SimpleQuote(cleanPrice[i]));
quote.push_back(cp);
}
RelinkableHandle<Quote> quoteHandle[numberOfBonds];
for (Size i=0; i<numberOfBonds; i++) {
quoteHandle[i].linkTo(quote[i]);
}
Integer lengths[] = { 1, 3, 5, 7, 10 };
Real coupons[] = { 0.0379, 0.0397, 0.0399, 0.0416, 0.0426 };
DayCounter dc = ActualActual(ActualActual::Bond);
BusinessDayConvention accrualConvention = Unadjusted;
BusinessDayConvention convention = Unadjusted;
Did I make any mistake here ?