Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22689/qlo
Modified Files:
.cvsignore instruments.hpp swap.cpp
Added Files:
vanillaswap.cpp vanillaswap.hpp
Removed Files:
simpleswap.cpp simpleswap.hpp
Log Message:
renaming simpleswap.* files as vanillaswap.*, according to the actual class name
Index: .cvsignore
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** .cvsignore 19 May 2006 16:56:16 -0000 1.1
--- .cvsignore 6 Jun 2006 08:10:05 -0000 1.2
***************
*** 21,27 ****
vo_schedule.*pp
vo_shortratemodels.*pp
- vo_simpleswap.*pp
vo_swap.*pp
vo_termstructures.*pp
vo_volatilities.*pp
vo_xibor.*pp
--- 21,27 ----
vo_schedule.*pp
vo_shortratemodels.*pp
vo_swap.*pp
vo_termstructures.*pp
+ vo_vanillaswap.*pp
vo_volatilities.*pp
vo_xibor.*pp
--- simpleswap.hpp DELETED ---
--- NEW FILE: vanillaswap.hpp ---
/*
Copyright (C) 2005, 2006 Eric Ehlers
Copyright (C) 2005 Plamen Neykov
Copyright (C) 2005 Aurelien Chanudet
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it under the
terms of the QuantLib license. You should have received a copy of the
license along with this program; if not, please email qua...@li...
The license is also available online at http://quantlib.org/html/license.html
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#ifndef qla_simpleswap_hpp
#define qla_simpleswap_hpp
#include <qlo/baseinstruments.hpp>
#include <qlo/xibor.hpp>
#include <ql/Instruments/vanillaswap.hpp>
namespace QuantLibAddin {
class VanillaSwap : public Instrument {
public:
VanillaSwap(
const QuantLib::Date &startDate,
const QuantLib::Date &maturity,
const QuantLib::Real &nominal,
const bool &payFixed,
const QuantLib::Rate &fixRate,
const QuantLib::Calendar& calendar,
const QuantLib::Frequency &fixFrqID,
const QuantLib::BusinessDayConvention &fixBDCID,
const QuantLib::DayCounter &fixDayCounter,
const bool &fixStartFromEnd,
const bool &fixLongFinal,
//const std::string &fltFrqID,
const QuantLib::DayCounter &floatDayCounter,
const boost::shared_ptr < QuantLib::Xibor > &index,
const bool &floatStartFromEnd,
const bool &floatLongFinal,
const QuantLib::Rate &floatSpread,
const boost::shared_ptr < QuantLib::YieldTermStructure > &discYC);
EXPORT_UNDERLYING_OBJECT(QuantLib::VanillaSwap, mInstrument)
const std::vector<std::vector<double> >& getFixLeg();
const std::vector<std::vector<double> >& getFloatLeg();
private:
std::vector<std::vector<double> > fixLeg;
std::vector<std::vector<double> > floatLeg;
};
}
#endif
--- NEW FILE: vanillaswap.cpp ---
/*
Copyright (C) 2005, 2006 Eric Ehlers
Copyright (C) 2005 Plamen Neykov
Copyright (C) 2005 Aurelien Chanudet
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it under the
terms of the QuantLib license. You should have received a copy of the
license along with this program; if not, please email qua...@li...
The license is also available online at http://quantlib.org/html/license.html
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#if defined(HAVE_CONFIG_H)
#include <qlo/config.hpp>
#endif
#include <qlo/vanillaswap.hpp>
#include <qlo/generalutils.hpp>
#include <qlo/termstructures.hpp>
#include <qlo/typefactory.hpp>
#include <ql/CashFlows/fixedratecoupon.hpp>
#include <ql/CashFlows/parcoupon.hpp>
#include <vector>
namespace QuantLibAddin {
VanillaSwap::VanillaSwap(
const QuantLib::Date &startDate,
const QuantLib::Date &maturity,
const QuantLib::Real &nominal,
const bool &payFixed,
const QuantLib::Rate &fixRate,
const QuantLib::Calendar& calendar,
const QuantLib::Frequency &fixFrq,
const QuantLib::BusinessDayConvention &fixBDC,
const QuantLib::DayCounter &fixDayCounter,
const bool &fixStartFromEnd,
const bool &fixLongFinal,
//const std::string &fltFrqID,
const QuantLib::DayCounter &floatDayCounter,
const boost::shared_ptr < QuantLib::Xibor > &index,
const bool &floatStartFromEnd,
const bool &floatLongFinal,
const QuantLib::Rate &floatSpread,
const boost::shared_ptr < QuantLib::YieldTermStructure > &discYC) {
QuantLib::Handle<QuantLib::YieldTermStructure> discountingTermStructure(discYC);
QuantLib::Schedule fixedSchedule(calendar, startDate, maturity, fixFrq, fixBDC,
QuantLib::Date(), fixStartFromEnd, fixLongFinal);
QuantLib::Schedule floatSchedule(calendar, startDate, maturity,
index->frequency(), index->businessDayConvention(),
QuantLib::Date(), floatStartFromEnd, floatLongFinal);
mInstrument = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::VanillaSwap(payFixed,
nominal,
fixedSchedule,
fixRate,
fixDayCounter,
floatSchedule,
index,
index->settlementDays(),
floatSpread,
floatDayCounter,
discountingTermStructure));
}
const std::vector<std::vector<double> >&
VanillaSwap::getFixLeg() {
const std::vector<boost::shared_ptr<QuantLib::CashFlow> >& flows = getObject().fixedLeg();
fixLeg.clear();
for(size_t i = 0; i < flows.size(); i++) {
std::vector<double> cf;
QuantLib::FixedRateCoupon& c = (QuantLib::FixedRateCoupon&) *(flows[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());
fixLeg.push_back(cf);
}
return fixLeg;
}
const std::vector<std::vector<double> >&
VanillaSwap::getFloatLeg() {
const std::vector<boost::shared_ptr<QuantLib::CashFlow> >& flows = getObject().floatingLeg();
floatLeg.clear();
for(size_t i = 0; i < flows.size(); i++) {
std::vector<double> cf;
QuantLib::ParCoupon& c = (QuantLib::ParCoupon&)*(flows[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());
floatLeg.push_back(cf);
}
return floatLeg;
}
}
--- simpleswap.cpp DELETED ---
Index: swap.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swap.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** swap.cpp 24 May 2006 14:59:44 -0000 1.2
--- swap.cpp 6 Jun 2006 08:10:05 -0000 1.3
***************
*** 36,40 ****
discountingTermStructure.linkTo(termStructure);
! mInstrument = boost::shared_ptr<QuantLib::Swap>(
new QuantLib::Swap(paidLeg, recvLeg, discountingTermStructure));
}
--- 36,40 ----
discountingTermStructure.linkTo(termStructure);
! mInstrument = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::Swap(paidLeg, recvLeg, discountingTermStructure));
}
Index: instruments.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/instruments.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** instruments.hpp 19 May 2006 16:56:16 -0000 1.1
--- instruments.hpp 6 Jun 2006 08:10:05 -0000 1.2
***************
*** 21,25 ****
#include <qlo/fixedcouponbond.hpp>
#include <qlo/zerocouponbond.hpp>
! #include <qlo/simpleswap.hpp>
#endif
--- 21,25 ----
#include <qlo/fixedcouponbond.hpp>
#include <qlo/zerocouponbond.hpp>
! #include <qlo/vanillaswap.hpp>
#endif
|