Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6488/qlo
Modified Files:
capfloor.cpp capfloor.hpp couponvectors.cpp couponvectors.hpp
swap.cpp swap.hpp
Log Message:
toward multi-leg swap
Index: couponvectors.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** couponvectors.hpp 29 Sep 2006 10:07:27 -0000 1.23
--- couponvectors.hpp 5 Oct 2006 14:42:51 -0000 1.24
***************
*** 31,43 ****
namespace QuantLibAddin {
! typedef std::vector<boost::shared_ptr<QuantLib::CashFlow> > CashFlowVector;
! std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector);
! class CouponVector : public ObjHandler::Object {
public:
double getBPS(
const QuantLib::Handle<QuantLib::YieldTermStructure>& h) const;
! const CashFlowVector& getVector();
const std::vector<std::vector<boost::any> > getLeg()
{
--- 31,43 ----
namespace QuantLibAddin {
! typedef std::vector<boost::shared_ptr<QuantLib::CashFlow> > Leg;
! std::vector<std::vector<boost::any> > flowAnalysis(Leg);
! class LegWrapper : public ObjHandler::Object {
public:
double getBPS(
const QuantLib::Handle<QuantLib::YieldTermStructure>& h) const;
! const Leg& getVector();
const std::vector<std::vector<boost::any> > getLeg()
{
***************
*** 45,52 ****
}
protected:
! CashFlowVector cashFlowVector_;
};
! class FixedRateCouponVector : public CouponVector {
public:
FixedRateCouponVector(
--- 45,52 ----
}
protected:
! Leg cashFlowVector_;
};
! class FixedRateCouponVector : public LegWrapper {
public:
FixedRateCouponVector(
***************
*** 58,62 ****
};
! class FloatingRateCouponVector : public CouponVector {
public:
FloatingRateCouponVector(
--- 58,62 ----
};
! class FloatingRateCouponVector : public LegWrapper {
public:
FloatingRateCouponVector(
***************
*** 83,87 ****
};
! class CMSCouponVector : public CouponVector {
public:
CMSCouponVector(
--- 83,87 ----
};
! class CMSCouponVector : public LegWrapper {
public:
CMSCouponVector(
***************
*** 102,106 ****
};
! class CMSZeroCouponVector : public CouponVector {
public:
CMSZeroCouponVector(
--- 102,106 ----
};
! class CMSZeroCouponVector : public LegWrapper {
public:
CMSZeroCouponVector(
***************
*** 121,125 ****
};
! class CMSInArrearsCouponVector : public CouponVector {
public:
CMSInArrearsCouponVector(
--- 121,125 ----
};
! class CMSInArrearsCouponVector : public LegWrapper {
public:
CMSInArrearsCouponVector(
Index: couponvectors.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** couponvectors.cpp 29 Sep 2006 10:07:27 -0000 1.33
--- couponvectors.cpp 5 Oct 2006 14:42:51 -0000 1.34
***************
*** 34,38 ****
namespace QuantLibAddin {
! std::vector<std::vector<boost::any> > flowAnalysis(CashFlowVector cashflows)
{
std::vector<std::vector<boost::any> > flowAnalysis_;
--- 34,38 ----
namespace QuantLibAddin {
! std::vector<std::vector<boost::any> > flowAnalysis(Leg cashflows)
{
std::vector<std::vector<boost::any> > flowAnalysis_;
***************
*** 140,144 ****
}
! double CouponVector::getBPS(const QuantLib::Handle<
QuantLib::YieldTermStructure>& hYTS) const
{
--- 140,144 ----
}
! double LegWrapper::getBPS(const QuantLib::Handle<
QuantLib::YieldTermStructure>& hYTS) const
{
***************
*** 147,151 ****
! const CashFlowVector& CouponVector::getVector()
{
return cashFlowVector_;
--- 147,151 ----
! const Leg& LegWrapper::getVector()
{
return cashFlowVector_;
Index: capfloor.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/capfloor.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** capfloor.cpp 31 Jul 2006 18:17:37 -0000 1.8
--- capfloor.cpp 5 Oct 2006 14:42:51 -0000 1.9
***************
*** 28,32 ****
CapFloor::CapFloor(
QuantLib::CapFloor::Type type,
! const boost::shared_ptr<CouponVector>& floatingLegWrapper,
const std::vector<QuantLib::Rate>& capRates,
const std::vector<QuantLib::Rate>& floorRates,
--- 28,32 ----
CapFloor::CapFloor(
QuantLib::CapFloor::Type type,
! const boost::shared_ptr<LegWrapper>& floatingLegWrapper,
const std::vector<QuantLib::Rate>& capRates,
const std::vector<QuantLib::Rate>& floorRates,
***************
*** 34,38 ****
const boost::shared_ptr<QuantLib::PricingEngine>& engine)
{
! const CashFlowVector& floatingLeg = floatingLegWrapper->getVector();
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::CapFloor(type,
--- 34,38 ----
const boost::shared_ptr<QuantLib::PricingEngine>& engine)
{
! const Leg& floatingLeg = floatingLegWrapper->getVector();
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::CapFloor(type,
Index: capfloor.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/capfloor.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** capfloor.hpp 31 Jul 2006 18:17:37 -0000 1.7
--- capfloor.hpp 5 Oct 2006 14:42:51 -0000 1.8
***************
*** 29,33 ****
public:
CapFloor(QuantLib::CapFloor::Type type,
! const boost::shared_ptr<CouponVector>& floatingLegWrapper,
const std::vector<QuantLib::Rate>& capRates,
const std::vector<QuantLib::Rate>& floorRates,
--- 29,33 ----
public:
CapFloor(QuantLib::CapFloor::Type type,
! const boost::shared_ptr<LegWrapper>& floatingLegWrapper,
const std::vector<QuantLib::Rate>& capRates,
const std::vector<QuantLib::Rate>& floorRates,
Index: swap.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** swap.cpp 31 Jul 2006 18:17:37 -0000 1.14
--- swap.cpp 5 Oct 2006 14:42:51 -0000 1.15
***************
*** 29,42 ****
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();
! const CashFlowVector& recvLeg = recvLegWrapper->getVector();
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::Swap(hYTS, paidLeg, recvLeg));
}
std::vector<std::vector<boost::any> > Swap::legAnalysis(QuantLib::Size i)
{
--- 29,53 ----
namespace QuantLibAddin {
! Swap::Swap(const boost::shared_ptr<LegWrapper>& paidLegWrapper,
! const boost::shared_ptr<LegWrapper>& recvLegWrapper,
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS)
{
! const Leg& paidLeg = paidLegWrapper->getVector();
! const Leg& recvLeg = recvLegWrapper->getVector();
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::Swap(hYTS, paidLeg, recvLeg));
}
+ Swap::Swap(const std::vector<boost::shared_ptr<LegWrapper> >& legWrappers,
+ const std::vector<bool>& payer,
+ const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS) {
+
+ std::vector<Leg> legs(legWrappers.size());
+ for (QuantLib::Size i = 0; i<legWrappers.size(); ++i)
+ legs[i] = legWrappers[i]->getVector();
+ libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
+ new QuantLib::Swap(hYTS, legs, payer));
+ }
+
std::vector<std::vector<boost::any> > Swap::legAnalysis(QuantLib::Size i)
{
Index: swap.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** swap.hpp 31 Jul 2006 18:17:37 -0000 1.11
--- swap.hpp 5 Oct 2006 14:42:51 -0000 1.12
***************
*** 30,35 ****
class Swap : public Instrument {
public:
! Swap(const boost::shared_ptr<CouponVector>& paidLegWrapper,
! const boost::shared_ptr<CouponVector>& recvLegWrapper,
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
--- 30,38 ----
class Swap : public Instrument {
public:
! Swap(const boost::shared_ptr<LegWrapper>& paidLegWrapper,
! const boost::shared_ptr<LegWrapper>& recvLegWrapper,
! const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
! Swap(const std::vector<boost::shared_ptr<LegWrapper> >& legWrappers,
! const std::vector<bool>& payer,
const QuantLib::Handle<QuantLib::YieldTermStructure>& hYTS);
|