[QuantLibAddin-cvs] QuantLibAddin/qlo couponvectors.cpp,1.16,1.17
Brought to you by:
ericehlers,
nando
|
From: Ferdinando A. <na...@us...> - 2006-08-01 07:29:22
|
Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32394/qlo Modified Files: couponvectors.cpp Log Message: richer flow analysis Index: couponvectors.cpp =================================================================== RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** couponvectors.cpp 31 Jul 2006 18:17:37 -0000 1.16 --- couponvectors.cpp 1 Aug 2006 07:29:17 -0000 1.17 *************** *** 36,69 **** { std::vector<std::vector<boost::any> > flowAnalysis_; - std::vector<boost::any> headings; - headings.push_back(std::string("Date")); - headings.push_back(std::string("Amount")); ! headings.push_back(std::string("Nominal")); ! headings.push_back(std::string("Accrual Start Date")); ! headings.push_back(std::string("Accrual End Date")); ! headings.push_back(std::string("Accrual Days")); ! headings.push_back(std::string("Day Counter")); ! headings.push_back(std::string("Accrual Period")); ! headings.push_back(std::string("Effective Rate")); ! headings.push_back(std::string("Accrued Amount")); - headings.push_back(std::string("Fixing Days")); - headings.push_back(std::string("Fixing Dates")); - //headings.push_back(std::string("Index")); - headings.push_back(std::string("Floor")); - headings.push_back(std::string("Gearing")); - headings.push_back(std::string("Index Fixing")); - headings.push_back(std::string("Conv. Adj.")); - headings.push_back(std::string("Spread")); - headings.push_back(std::string("Cap")); flowAnalysis_.push_back(headings); for(QuantLib::Size i=0; i<cashflows.size(); i++) { ! std::vector<boost::any> cf; ! ! cf.push_back(cashflows[i]->date().serialNumber()); ! cf.push_back(cashflows[i]->amount()); boost::shared_ptr<QuantLib::Coupon> c = --- 36,71 ---- { std::vector<std::vector<boost::any> > flowAnalysis_; ! std::vector<boost::any> headings(18); ! headings[0]=std::string("Date"); ! headings[1]=std::string("Amount"); ! ! headings[2]=std::string("Nominal"); ! headings[3]=std::string("Accrual Start Date"); ! headings[4]=std::string("Accrual End Date"); ! headings[5]=std::string("Accrual Days"); ! headings[6]=std::string("Day Counter"); ! headings[7]=std::string("Accrual Period"); ! headings[8]=std::string("Effective Rate"); ! ! headings[ 9]=std::string("Fixing Days"); ! headings[10]=std::string("Fixing Dates"); ! headings[11]=std::string("Index"); ! headings[12]=std::string("Floor"); ! headings[13]=std::string("Gearing"); ! headings[14]=std::string("Index Fixing"); ! headings[15]=std::string("Conv. Adj."); ! headings[16]=std::string("Spread"); ! headings[17]=std::string("Cap"); ! headings[18]=std::string("---"); ! headings[19]=std::string("---"); flowAnalysis_.push_back(headings); for(QuantLib::Size i=0; i<cashflows.size(); i++) { ! std::vector<boost::any> cf(20, std::string("N/A")); ! cf[0]=cashflows[i]->date().serialNumber(); ! cf[1]=cashflows[i]->amount(); boost::shared_ptr<QuantLib::Coupon> c = *************** *** 71,82 **** QL_REQUIRE(c, "error processing cash flow vector - unable to convert item #" << i << " to an object of class QuantLib::Coupon") ! cf.push_back(c->nominal()); ! cf.push_back(c->accrualStartDate().serialNumber()); ! cf.push_back(c->accrualEndDate().serialNumber()); ! cf.push_back(c->accrualDays()); ! cf.push_back(c->dayCounter().name()); ! cf.push_back(c->accrualPeriod()); ! cf.push_back(c->rate()); ! cf.push_back(c->accruedAmount(QuantLib::Settings::instance().evaluationDate())); boost::shared_ptr<QuantLib::FloatingRateCoupon> floatingCoupon = --- 73,83 ---- QL_REQUIRE(c, "error processing cash flow vector - unable to convert item #" << i << " to an object of class QuantLib::Coupon") ! cf[2]=c->nominal(); ! cf[3]=c->accrualStartDate().serialNumber(); ! cf[4]=c->accrualEndDate().serialNumber(); ! cf[5]=c->accrualDays(); ! cf[6]=c->dayCounter().name(); ! cf[7]=c->accrualPeriod(); ! cf[8]=c->rate(); boost::shared_ptr<QuantLib::FloatingRateCoupon> floatingCoupon = *************** *** 87,122 **** cashflows[i]); if (floatingCoupon!=0) { ! cf.push_back(floatingCoupon->fixingDays()); ! cf.push_back(floatingCoupon->fixingDate().serialNumber()); ! //cf.push_back(floatingCoupon->index()); ! cf.push_back(std::string("N/A")); ! cf.push_back(floatingCoupon->gearing()); ! cf.push_back(floatingCoupon->indexFixing()); ! cf.push_back(floatingCoupon->convexityAdjustment( ! floatingCoupon->indexFixing())); ! cf.push_back(floatingCoupon->spread()); ! cf.push_back(std::string("N/A")); } else if (cmsCoupon!=0) { ! cf.push_back(cmsCoupon->fixingDays()); ! cf.push_back(cmsCoupon->fixingDate().serialNumber()); ! //cf.push_back(cmsCoupon->index()); ! cf.push_back(cmsCoupon->floor()); ! cf.push_back(cmsCoupon->gearing()); ! cf.push_back(cmsCoupon->indexFixing()); ! cf.push_back(cmsCoupon->convexityAdjustment( ! cmsCoupon->indexFixing())); ! cf.push_back(cmsCoupon->spread()); ! cf.push_back(cmsCoupon->cap()); ! } else { ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); ! cf.push_back(std::string("N/A")); } - flowAnalysis_.push_back(cf); } --- 88,113 ---- cashflows[i]); if (floatingCoupon!=0) { ! cf[ 9]=floatingCoupon->fixingDays(); ! cf[10]=floatingCoupon->fixingDate().serialNumber(); ! cf[11]=std::string("N/A"); ! cf[12]=std::string("N/A"); ! cf[13]=floatingCoupon->gearing(); ! cf[14]=floatingCoupon->indexFixing(); ! cf[15]=floatingCoupon->convexityAdjustment( ! floatingCoupon->indexFixing()); ! cf[16]=floatingCoupon->spread(); ! cf[17]=std::string("N/A"); } else if (cmsCoupon!=0) { ! cf[ 9]=cmsCoupon->fixingDays(); ! cf[10]=cmsCoupon->fixingDate().serialNumber(); ! cf[11]=cmsCoupon->index()->name(); ! cf[12]=cmsCoupon->floor(); ! cf[13]=cmsCoupon->gearing(); ! cf[14]=cmsCoupon->indexFixing(); ! cf[15]=cmsCoupon->convexityAdjustment( ! cmsCoupon->indexFixing()); ! cf[16]=cmsCoupon->spread(); ! cf[17]=cmsCoupon->cap(); } flowAnalysis_.push_back(cf); } |