Hi,
I am doing some experiments in the examples in quantlib testsuite. in swap.cpp of the testsuite project, I made the fix and floating legs the same, and valuing swaps with no spreads on a flat 0.05 curve. should I get the fix rate = 0.05? CommonVars() { type = VanillaSwap::Payer; settlementDays = 2; nominal = 100.0; fixedConvention = ModifiedFollowing; floatingConvention = ModifiedFollowing; fixedFrequency = Semiannual; floatingFrequency = Semiannual; fixedDayCount = Actual365Fixed(); index = boost::shared_ptr<IborIndex>(new Euribor(Period(floatingFrequency), termStructure)); calendar = index->fixingCalendar(); today = calendar.adjust(Date::todaysDate()); Settings::instance().evaluationDate() = today; settlement = calendar.advance(today,settlementDays,Days); termStructure.linkTo(flatRate(settlement,0.05,Actual365Fixed())); } ... Integer lengths[] = { 1, 2, 5, 10, 20 }; Spread spreads[] = { 0, 0, 0.0, 0, 0 }; for (Size i=0; i<LENGTH(lengths); i++) { for (Size j=0; j<LENGTH(spreads); j++) { boost::shared_ptr<VanillaSwap> swap = vars.makeSwap(lengths[i],0.0,spreads[j]); swap = vars.makeSwap(lengths[i],swap->fairRate(),spreads[j]); Rate fixR = swap->fixedRate(); ... fixR = 0.051271096376024117 shouldn't it be 0.05 flat? I suspect I miss out something in Euribor index. But I kind of lost in tracing, can someone help? Thanks Cliffy |
On Mon, 2010-02-22 at 14:33 -0800, Cliffy wrote:
> I am doing some experiments in the examples in quantlib testsuite. > > in swap.cpp of the testsuite project, I made the fix and floating legs the > same, and valuing swaps with no spreads on a flat 0.05 curve. should I get > the fix rate = 0.05? Yes, but... > CommonVars() { > ... > fixedDayCount = Actual365Fixed(); > ... > > } > try fixedDayCount = index->dayCounter(). Euribor accrues at Actual/360. Luigi -- Newton's Law of Gravitation: What goes up must come down. But don't expect it to come down where you can find it. Murphy's Law applies to Newton's. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
thanks, I can see now from it's constructor Euribor accrues at Actual/360
I made the change - CommonVars() { type = VanillaSwap::Payer; settlementDays = 2; nominal = 100.0; fixedConvention = ModifiedFollowing; floatingConvention = ModifiedFollowing; fixedFrequency = Semiannual; floatingFrequency = Semiannual; index = boost::shared_ptr<IborIndex>(new Euribor(Period(floatingFrequency), termStructure)); calendar = index->fixingCalendar(); fixedDayCount = index->dayCounter(); today = calendar.adjust(Date::todaysDate()); Settings::instance().evaluationDate() = today; settlement = calendar.advance(today,settlementDays,Days); //termStructure.linkTo(flatRate(settlement,0.05,Actual365Fixed())); //0.049936653874198329 termStructure.linkTo(flatRate(settlement,0.05,fixedDayCount)); //0.050639044891605742 should I get even closer? like flat 0.0500000000?? Cheers, Cliffy
|
On Tue, 2010-02-23 at 07:01 -0800, Cliffy wrote:
> thanks, I can see now from it's constructor Euribor accrues at Actual/360 > > I made the change - > > //termStructure.linkTo(flatRate(settlement,0.05,Actual365Fixed())); > //0.049936653874198329 > termStructure.linkTo(flatRate(settlement,0.05,fixedDayCount)); > //0.050639044891605742 > > > should I get even closer? like flat 0.0500000000?? Apologies for the delay. The answer is that the fair rate is the one for the coupons, so it's 0.050639 semiannual, simply compounded. The rate you've used in flatRate is 0.05 continuously compounded. If you make the calculations, they'll turn out to be the same. Luigi -- Academic: a term of opprobrium applied to those that do their job well by those who cannot. -- Sir Ernest Gowers ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |