Ok, this is driving me crazy. I'm sure there is an easy way to do it, but I
can't for the life of me find it. I have a collection of US treasury zero rates and dates. I want to extrapolate those values to find the rates in between the given dates, and I want the rates unchanged (no compounding). Which function do I use? Can someone direct me to some simple code that might help me out? Thanks in advance. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hello John, If you have spot zero rates use InterpolatedZeroCurve class to build your curve just like the following. I think the constructor assumes continuous compounding for the input zero rates as the outputs confirm that. BTW all rates must have a compounding measure to be valid Hope this helps. std::vector< Date > dates; dates.push_back(todaysDate); dates.push_back(todaysDate+1*Years); dates.push_back(todaysDate+2*Years); dates.push_back(todaysDate+3*Years); dates.push_back(todaysDate+4*Years); dates.push_back(todaysDate+5*Years); std::vector< Rate> rates; rates.push_back(0); rates.push_back(0.03); rates.push_back(0.04); rates.push_back(0.046); rates.push_back(0.05); rates.push_back(0.053); boost::shared_ptr<YieldTermStructure>izc(new InterpolatedZeroCurve<Linear>(dates,rates,termStructureDayCounter)); std::cout <<"refernce date is:"<<izc->referenceDate()<<"\n"; testDate1 = izc->referenceDate()+ 1*Years; rfdc = izc->dayCounter(); zero1 = izc->zeroRate(testDate1, rfdc,Continuous, NoFrequency); std::cout <<"1-year zero rate now:"<<zero1<< std::endl; testDate2 = izc->referenceDate()+ 2*Years; zero2 = izc->zeroRate(testDate2, rfdc,Continuous, NoFrequency); std::cout <<"2-year zero rate now:"<<zero2<< std::endl; Jing John Maiden <[hidden email]> wrote: Ok, this is driving me crazy. I'm sure there is an easy way to do it, but I
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |