Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6215/qlo
Modified Files:
bonds.cpp bonds.hpp capfloor.cpp capfloor.hpp
couponvectors.cpp couponvectors.hpp index.hpp swap.cpp
swap.hpp vanillaswap.hpp
Log Message:
refactoring flowanalysis
Index: couponvectors.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** couponvectors.hpp 31 Jul 2006 11:21:16 -0000 1.12
--- couponvectors.hpp 31 Jul 2006 15:48:10 -0000 1.13
***************
*** 31,34 ****
--- 31,35 ----
typedef std::vector<boost::shared_ptr<QuantLib::CashFlow> > CashFlowVector;
+ // std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector);
std::vector<std::vector<double> > flowAnalysis(CashFlowVector);
***************
*** 36,43 ****
class CouponVector : public ObjHandler::Object {
public:
- virtual std::vector<std::vector<double> > getLeg() = 0;
double getBPS(
const QuantLib::Handle<QuantLib::YieldTermStructure>& h) const;
const CashFlowVector& getVector();
protected:
CashFlowVector cashFlowVector_;
--- 37,48 ----
class CouponVector : public ObjHandler::Object {
public:
double getBPS(
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_);
+ }
protected:
CashFlowVector cashFlowVector_;
***************
*** 52,57 ****
const std::vector<double>& couponRates,
const QuantLib::DayCounter& dayCountID);
-
- virtual std::vector<std::vector<double> > getLeg();
};
--- 57,60 ----
***************
*** 64,69 ****
const boost::shared_ptr<QuantLib::Xibor>& index,
const std::vector<QuantLib::Spread>& spreads);
-
- virtual std::vector<std::vector<double> > getLeg();
};
--- 67,70 ----
***************
*** 83,89 ****
const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& vol,
QuantLib::ConvexityAdjustmentPricer::Type typeOfConvexityAdjustment);
- virtual std::vector<std::vector<double> > getLeg();
};
-
}
--- 84,88 ----
Index: couponvectors.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** couponvectors.cpp 31 Jul 2006 11:21:16 -0000 1.13
--- couponvectors.cpp 31 Jul 2006 15:48:10 -0000 1.14
***************
*** 34,41 ****
std::vector<std::vector<double> > flowAnalysis(CashFlowVector cashflows)
{
std::vector<std::vector<double> > flowAnalysis_;
! for(QuantLib::Size i = 0; i < cashflows.size(); i++) {
! std::vector<double> cf;
cf.push_back(cashflows[i]->date().serialNumber());
--- 34,61 ----
std::vector<std::vector<double> > flowAnalysis(CashFlowVector cashflows)
+ //std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector cashflows)
{
+ //std::vector<std::vector<boost::any> > flowAnalysis_;
+ //std::vector<boost::any> cf;
+ //cf.push_back(std::string("Date"));
+ //cf.push_back(std::string("Amount"));
+ //cf.push_back(std::string("Nominal"));
+ //cf.push_back(std::string("Accrual Start Date"));
+ //cf.push_back(std::string("Accrual End Date"));
+ //cf.push_back(std::string("Accrual Days"));
+ //cf.push_back(std::string("Day Counter"));
+ //cf.push_back(std::string("Accrual Period"));
+ //cf.push_back(std::string("Effective Rate"));
+ //cf.push_back(std::string("Fixing Days"));
+ //cf.push_back(std::string("Fixing Dates"));
+ //cf.push_back(std::string("Gearing"));
+ //cf.push_back(std::string("Index Fixing"));
+ //cf.push_back(std::string("Conv. Adj."));
+ //cf.push_back(std::string("Spread"));
+
std::vector<std::vector<double> > flowAnalysis_;
! std::vector<double> cf;
! //for(QuantLib::Size i = 1; i <= cashflows.size(); i++) {
! for(QuantLib::Size i=0; i<cashflows.size(); i++) {
cf.push_back(cashflows[i]->date().serialNumber());
***************
*** 110,132 ****
}
- std::vector<std::vector<double> > FixedRateCouponVector::getLeg()
- {
- std::vector<std::vector<double> > leg;
-
- for (std::size_t i=0 ; i < cashFlowVector_.size() ; i++) {
- std::vector<double> cf;
- QuantLib::FixedRateCoupon& c =
- (QuantLib::FixedRateCoupon&) *(cashFlowVector_[i]);
- cf.push_back(c.accrualStartDate().serialNumber());
- cf.push_back(c.accrualEndDate().serialNumber());
- cf.push_back(c.date().serialNumber());
- cf.push_back(c.accrualPeriod());
- cf.push_back(c.accrualDays());
- cf.push_back(c.amount());
- leg.push_back(cf);
- }
- return leg;
- }
-
FloatingRateCouponVector::FloatingRateCouponVector(
const boost::shared_ptr<QuantLib::Schedule>& schedule,
--- 130,133 ----
***************
*** 146,184 ****
}
- std::vector<std::vector<double> > FloatingRateCouponVector::getLeg() {
- std::vector<std::vector<double> > leg;
-
- for (std::size_t i=0 ; i < cashFlowVector_.size() ; i++) {
- std::vector<double> cf;
- QuantLib::ParCoupon& c =
- (QuantLib::ParCoupon&) *(cashFlowVector_[i]);
- cf.push_back(c.accrualStartDate().serialNumber());
- cf.push_back(c.accrualEndDate().serialNumber());
- cf.push_back(c.date().serialNumber());
- cf.push_back(c.fixingDate().serialNumber());
- cf.push_back(c.accrualPeriod());
- cf.push_back(c.accrualDays());
- cf.push_back(c.amount());
- cf.push_back(c.indexFixing());
- leg.push_back(cf);
- }
-
- return leg;
- }
-
CMSCouponVector::CMSCouponVector(
! const boost::shared_ptr<QuantLib::Schedule>& schedule,
! QuantLib::BusinessDayConvention paymentAdjustment,
! const std::vector<QuantLib::Real>& nominals,
! const boost::shared_ptr<QuantLib::SwapIndex>& index,
! QuantLib::Integer fixingDays,
! const QuantLib::DayCounter& dayCounter,
! const std::vector<QuantLib::Rate>& baseRates,
! const std::vector<QuantLib::Real>& fractions,
! const std::vector<QuantLib::Rate>& caps,
! const std::vector<QuantLib::Rate>& floors,
! const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& vol,
! QuantLib::ConvexityAdjustmentPricer::Type typeOfConvexityAdjustment)
! {
cashFlowVector_ = QuantLib::CMSCouponVector(*schedule,
paymentAdjustment,
--- 147,164 ----
}
CMSCouponVector::CMSCouponVector(
! const boost::shared_ptr<QuantLib::Schedule>& schedule,
! QuantLib::BusinessDayConvention paymentAdjustment,
! const std::vector<QuantLib::Real>& nominals,
! const boost::shared_ptr<QuantLib::SwapIndex>& index,
! QuantLib::Integer fixingDays,
! const QuantLib::DayCounter& dayCounter,
! const std::vector<QuantLib::Rate>& baseRates,
! const std::vector<QuantLib::Real>& fractions,
! const std::vector<QuantLib::Rate>& caps,
! const std::vector<QuantLib::Rate>& floors,
! const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& vol,
! QuantLib::ConvexityAdjustmentPricer::Type typeOfConvexityAdjustment) {
!
cashFlowVector_ = QuantLib::CMSCouponVector(*schedule,
paymentAdjustment,
***************
*** 195,217 ****
}
- std::vector<std::vector<double> > CMSCouponVector::getLeg()
- {
- std::vector<std::vector<double> > leg;
- for (std::size_t i=0 ; i < cashFlowVector_.size() ; i++) {
- std::vector<double> cf;
- QuantLib::ParCoupon& c =
- (QuantLib::ParCoupon&) *(cashFlowVector_[i]);
- cf.push_back(c.accrualStartDate().serialNumber());
- cf.push_back(c.accrualEndDate().serialNumber());
- cf.push_back(c.date().serialNumber());
- cf.push_back(c.fixingDate().serialNumber());
- cf.push_back(c.accrualPeriod());
- cf.push_back(c.accrualDays());
- cf.push_back(c.amount());
- cf.push_back(c.indexFixing());
- leg.push_back(cf);
- }
- return leg;
- }
-
}
--- 175,177 ----
Index: capfloor.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/capfloor.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** capfloor.cpp 27 Jul 2006 09:37:46 -0000 1.6
--- capfloor.cpp 31 Jul 2006 15:48:10 -0000 1.7
***************
*** 45,48 ****
--- 45,49 ----
std::vector<std::vector<double> > CapFloor::legAnalysis()
+ //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.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** vanillaswap.hpp 27 Jun 2006 21:17:33 -0000 1.9
--- vanillaswap.hpp 31 Jul 2006 15:48:11 -0000 1.10
***************
*** 40,47 ****
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
! std::vector<std::vector<double> > fixedLeg() {
return Swap::legAnalysis(0);
}
! std::vector<std::vector<double> > floatingLeg() {
return Swap::legAnalysis(1);
}
--- 40,52 ----
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);
}
Index: capfloor.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/capfloor.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** capfloor.hpp 26 Jun 2006 21:31:03 -0000 1.5
--- capfloor.hpp 31 Jul 2006 15:48:10 -0000 1.6
***************
*** 35,38 ****
--- 35,39 ----
const boost::shared_ptr<QuantLib::PricingEngine>& engine);
+ //std::vector<std::vector<boost::any> > legAnalysis();
std::vector<std::vector<double> > legAnalysis();
};
Index: index.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/index.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** index.hpp 28 Jul 2006 16:10:55 -0000 1.8
--- index.hpp 31 Jul 2006 15:48:10 -0000 1.9
***************
*** 26,29 ****
--- 26,30 ----
#include <ql/handle.hpp>
#include <ql/yieldtermstructure.hpp>
+ #include <ql/Indexes/swapindex.hpp>
namespace QuantLibAddin {
Index: bonds.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/bonds.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** bonds.hpp 22 Jun 2006 10:18:48 -0000 1.7
--- bonds.hpp 31 Jul 2006 15:48:10 -0000 1.8
***************
*** 28,35 ****
namespace QuantLibAddin {
! class Bond : public Instrument {
public:
std::vector<std::vector<double> > flowAnalysis();
!
};
--- 28,36 ----
namespace QuantLibAddin {
! class Bond : public Instrument
! {
public:
std::vector<std::vector<double> > flowAnalysis();
! //std::vector<std::vector<boost::any> > flowAnalysis();
};
Index: bonds.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/bonds.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** bonds.cpp 27 Jul 2006 09:37:46 -0000 1.7
--- bonds.cpp 31 Jul 2006 15:48:10 -0000 1.8
***************
*** 33,37 ****
namespace QuantLibAddin {
! std::vector<std::vector<double> > Bond::flowAnalysis() {
boost::shared_ptr<QuantLib::Bond> temp;
getLibraryObject(temp);
--- 33,39 ----
namespace QuantLibAddin {
! //std::vector<std::vector<boost::any> > Bond::flowAnalysis()
! std::vector<std::vector<double> > Bond::flowAnalysis()
! {
boost::shared_ptr<QuantLib::Bond> temp;
getLibraryObject(temp);
Index: swap.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** swap.cpp 27 Jul 2006 09:37:46 -0000 1.12
--- swap.cpp 31 Jul 2006 15:48:11 -0000 1.13
***************
*** 29,36 ****
namespace QuantLibAddin {
! Swap::Swap(
! const boost::shared_ptr<CouponVector>& paidLegWrapper,
! const boost::shared_ptr<CouponVector>& recvLegWrapper,
! const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS)
{
const CashFlowVector& paidLeg = paidLegWrapper->getVector();
--- 29,35 ----
namespace QuantLibAddin {
! Swap::Swap(const boost::shared_ptr<CouponVector>& paidLegWrapper,
! const boost::shared_ptr<CouponVector>& recvLegWrapper,
! const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS)
{
const CashFlowVector& paidLeg = paidLegWrapper->getVector();
***************
*** 40,43 ****
--- 39,43 ----
}
+ //std::vector<std::vector<boost::any> > Swap::legAnalysis(QuantLib::Size i)
std::vector<std::vector<double> > Swap::legAnalysis(QuantLib::Size i)
{
Index: swap.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** swap.hpp 26 Jun 2006 21:31:03 -0000 1.9
--- swap.hpp 31 Jul 2006 15:48:11 -0000 1.10
***************
*** 34,37 ****
--- 34,38 ----
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);
|