Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16449/qlo
Modified Files:
bonds.cpp bonds.hpp capfloor.cpp capfloor.hpp
couponvectors.cpp couponvectors.hpp swap.cpp swap.hpp
vanillaswap.hpp
Log Message:
richer flow analysis
Index: couponvectors.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** couponvectors.hpp 31 Jul 2006 15:48:10 -0000 1.13
--- couponvectors.hpp 31 Jul 2006 18:17:37 -0000 1.14
***************
*** 31,37 ****
typedef std::vector<boost::shared_ptr<QuantLib::CashFlow> > CashFlowVector;
! // std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector);
! std::vector<std::vector<double> > flowAnalysis(CashFlowVector);
!
class CouponVector : public ObjHandler::Object {
--- 31,35 ----
typedef std::vector<boost::shared_ptr<QuantLib::CashFlow> > CashFlowVector;
! std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector);
class CouponVector : public ObjHandler::Object {
***************
*** 40,45 ****
const QuantLib::Handle<QuantLib::YieldTermStructure>& h) const;
const CashFlowVector& getVector();
! const std::vector<std::vector<double> > getLeg()
! //const std::vector<std::vector<boost::any> > getLeg()
{
return flowAnalysis(cashFlowVector_);
--- 38,42 ----
const QuantLib::Handle<QuantLib::YieldTermStructure>& h) const;
const CashFlowVector& getVector();
! const std::vector<std::vector<boost::any> > getLeg()
{
return flowAnalysis(cashFlowVector_);
Index: couponvectors.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** couponvectors.cpp 31 Jul 2006 17:09:19 -0000 1.15
--- couponvectors.cpp 31 Jul 2006 18:17:37 -0000 1.16
***************
*** 33,62 ****
namespace QuantLibAddin {
! std::vector<std::vector<double> > flowAnalysis(CashFlowVector cashflows)
! //std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector cashflows)
{
! std::vector<std::vector<double> > flowAnalysis_;
! //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("Fixing Days"));
! //headings.push_back(std::string("Fixing Dates"));
! //headings.push_back(std::string("Gearing"));
! //headings.push_back(std::string("Index Fixing"));
! //headings.push_back(std::string("Conv. Adj."));
! //headingspush_back(std::string("Spread"));
! //flowAnalysis_.push_back(headings);
for(QuantLib::Size i=0; i<cashflows.size(); i++)
{
! std::vector<double> cf;
cf.push_back(cashflows[i]->date().serialNumber());
--- 33,66 ----
namespace QuantLibAddin {
! std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector cashflows)
{
! 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());
***************
*** 71,100 ****
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());
boost::shared_ptr<QuantLib::FloatingRateCoupon> floatingCoupon =
boost::dynamic_pointer_cast<QuantLib::FloatingRateCoupon>(
cashflows[i]);
if (floatingCoupon!=0) {
cf.push_back(floatingCoupon->fixingDays());
cf.push_back(floatingCoupon->fixingDate().serialNumber());
cf.push_back(floatingCoupon->gearing());
cf.push_back(floatingCoupon->indexFixing());
! QuantLib::Rate convAdj = floatingCoupon->rate()- floatingCoupon->spread();
! convAdj -= floatingCoupon->gearing()*
! floatingCoupon->indexFixing();
! if (floatingCoupon->gearing()!=0)
! convAdj /= floatingCoupon->gearing();
! cf.push_back(convAdj);
cf.push_back(floatingCoupon->spread());
} else {
! cf.push_back(0.0);
! cf.push_back(0.0);
! cf.push_back(0.0);
! cf.push_back(0.0);
! cf.push_back(0.0);
! cf.push_back(0.0);
}
--- 75,120 ----
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 =
boost::dynamic_pointer_cast<QuantLib::FloatingRateCoupon>(
cashflows[i]);
+ boost::shared_ptr<QuantLib::CMSCoupon> cmsCoupon =
+ boost::dynamic_pointer_cast<QuantLib::CMSCoupon>(
+ 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"));
}
Index: capfloor.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/capfloor.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** capfloor.cpp 31 Jul 2006 15:48:10 -0000 1.7
--- capfloor.cpp 31 Jul 2006 18:17:37 -0000 1.8
***************
*** 44,49 ****
}
! std::vector<std::vector<double> > CapFloor::legAnalysis()
! //std::vector<std::vector<boost::any> > CapFloor::legAnalysis()
{
boost::shared_ptr<QuantLib::CapFloor> temp;
--- 44,48 ----
}
! std::vector<std::vector<boost::any> > CapFloor::legAnalysis()
{
boost::shared_ptr<QuantLib::CapFloor> temp;
Index: vanillaswap.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/vanillaswap.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** vanillaswap.hpp 31 Jul 2006 15:48:11 -0000 1.10
--- vanillaswap.hpp 31 Jul 2006 18:17:37 -0000 1.11
***************
*** 40,51 ****
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
! //std::vector<std::vector<boost::any> > fixedLeg()
! std::vector<std::vector<double> > fixedLeg()
{
return Swap::legAnalysis(0);
}
! //std::vector<std::vector<boost::any> > floatingLeg()
! std::vector<std::vector<double> > floatingLeg()
{
return Swap::legAnalysis(1);
--- 40,49 ----
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
! std::vector<std::vector<boost::any> > fixedLeg()
{
return Swap::legAnalysis(0);
}
! std::vector<std::vector<boost::any> > floatingLeg()
{
return Swap::legAnalysis(1);
Index: capfloor.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/capfloor.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** capfloor.hpp 31 Jul 2006 15:48:10 -0000 1.6
--- capfloor.hpp 31 Jul 2006 18:17:37 -0000 1.7
***************
*** 35,40 ****
const boost::shared_ptr<QuantLib::PricingEngine>& engine);
! //std::vector<std::vector<boost::any> > legAnalysis();
! std::vector<std::vector<double> > legAnalysis();
};
--- 35,39 ----
const boost::shared_ptr<QuantLib::PricingEngine>& engine);
! std::vector<std::vector<boost::any> > legAnalysis();
};
Index: bonds.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/bonds.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** bonds.hpp 31 Jul 2006 15:48:10 -0000 1.8
--- bonds.hpp 31 Jul 2006 18:17:37 -0000 1.9
***************
*** 31,36 ****
{
public:
! std::vector<std::vector<double> > flowAnalysis();
! //std::vector<std::vector<boost::any> > flowAnalysis();
};
--- 31,35 ----
{
public:
! std::vector<std::vector<boost::any> > flowAnalysis();
};
Index: bonds.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/bonds.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** bonds.cpp 31 Jul 2006 15:48:10 -0000 1.8
--- bonds.cpp 31 Jul 2006 18:17:37 -0000 1.9
***************
*** 33,38 ****
namespace QuantLibAddin {
! //std::vector<std::vector<boost::any> > Bond::flowAnalysis()
! std::vector<std::vector<double> > Bond::flowAnalysis()
{
boost::shared_ptr<QuantLib::Bond> temp;
--- 33,37 ----
namespace QuantLibAddin {
! std::vector<std::vector<boost::any> > Bond::flowAnalysis()
{
boost::shared_ptr<QuantLib::Bond> temp;
Index: swap.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** swap.cpp 31 Jul 2006 15:48:11 -0000 1.13
--- swap.cpp 31 Jul 2006 18:17:37 -0000 1.14
***************
*** 39,44 ****
}
! //std::vector<std::vector<boost::any> > Swap::legAnalysis(QuantLib::Size i)
! std::vector<std::vector<double> > Swap::legAnalysis(QuantLib::Size i)
{
boost::shared_ptr<QuantLib::Swap> temp;
--- 39,43 ----
}
! std::vector<std::vector<boost::any> > Swap::legAnalysis(QuantLib::Size i)
{
boost::shared_ptr<QuantLib::Swap> temp;
Index: swap.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** swap.hpp 31 Jul 2006 15:48:11 -0000 1.10
--- swap.hpp 31 Jul 2006 18:17:37 -0000 1.11
***************
*** 34,39 ****
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
! //std::vector<std::vector<boost::any> > legAnalysis(QuantLib::Size i);
! std::vector<std::vector<double> > legAnalysis(QuantLib::Size i);
protected:
--- 34,38 ----
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
! std::vector<std::vector<boost::any> > legAnalysis(QuantLib::Size i);
protected:
|