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 |
Different compoundings. The rates you're passing to the zero curve are assumed by default to be continuously compounded. So when you ask for rates with simple compounding, you get that 5% continuously compounded for 1 year is equivalent to 5.12% simply compounded. Ditto for 2 years, 3 years etc. Luigi On Jun 14, 2011, at 7:28 AM, d0tc0mguy wrote: > 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 > > -- > View this message in context: http://old.nabble.com/InterpolatedZeroCurve----%3E-Understanding-Problem-tp31839931p31839931.html > Sent from the quantlib-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Thanks Luigi
|
Free forum by Nabble | Edit this page |