Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23737/qlo
Modified Files:
.cvsignore couponvectors.hpp fixedcouponbond.cpp
Added Files:
bonds.cpp bonds.hpp
Log Message:
Bond refactoring
Index: couponvectors.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** couponvectors.hpp 9 Jun 2006 18:58:47 -0000 1.3
--- couponvectors.hpp 14 Jun 2006 18:34:31 -0000 1.4
***************
*** 60,64 ****
const std::vector<double> &nominals,
const boost::shared_ptr < QuantLib::Xibor > &index,
! const std::vector<double> &spreads);
virtual std::vector<std::vector<double> > getLeg();
--- 60,64 ----
const std::vector<double> &nominals,
const boost::shared_ptr < QuantLib::Xibor > &index,
! const std::vector<QuantLib::Spread> &spreads);
virtual std::vector<std::vector<double> > getLeg();
--- NEW FILE: bonds.hpp ---
/*
Copyright (C) 2006 Ferdinando Ametrano
Copyright (C) 2005, 2006 Eric Ehlers
Copyright (C) 2005 Plamen Neykov
Copyright (C) 2005 Walter Penschke
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_bonds_hpp
#define qla_bonds_hpp
#include <qlo/baseinstruments.hpp>
#include <qlo/xibor.hpp>
namespace QuantLibAddin {
class Bond : public Instrument {
};
class ZeroCouponBond : public Bond {
public:
ZeroCouponBond(
const QuantLib::Date& issueDate,
const QuantLib::Date& maturityDate,
const long settlementDays,
const QuantLib::DayCounter& dayCounter,
const QuantLib::Calendar& calendar,
const QuantLib::BusinessDayConvention& convention,
const double redemption,
const boost::shared_ptr<QuantLib::YieldTermStructure>& termStructure);
};
class FixedCouponBond : public Bond {
public:
FixedCouponBond(
const QuantLib::Date& issueDate,
const QuantLib::Date& datedDate,
const QuantLib::Date& maturityDate,
const long settlementDays,
const std::vector<double>& coupons,
const double redemption,
const QuantLib::Frequency& frequency,
const QuantLib::DayCounter& dayCounter,
const QuantLib::BusinessDayConvention& accrualConvention,
const QuantLib::BusinessDayConvention& paymentConvention,
const QuantLib::Calendar& calendar,
const bool startFromEnd,
const bool longFinal,
const boost::shared_ptr<QuantLib::YieldTermStructure>& termStructure);
};
}
#endif
--- NEW FILE: bonds.cpp ---
/*
Copyright (C) 2006 Ferdinando Ametrano
Copyright (C) 2005, 2006 Eric Ehlers
Copyright (C) 2005 Plamen Neykov
Copyright (C) 2005 Walter Penschke
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/bonds.hpp>
#include <qlo/generalutils.hpp>
#include <qlo/termstructures.hpp>
#include <qlo/typefactory.hpp>
#include <ql/Instruments/fixedcouponbond.hpp>
#include <ql/Instruments/floatingratebond.hpp>
#include <ql/Instruments/zerocouponbond.hpp>
namespace QuantLibAddin {
ZeroCouponBond::ZeroCouponBond(
const QuantLib::Date& issueDate,
const QuantLib::Date& maturityDate,
const long settlementDays,
const QuantLib::DayCounter& dayCounter,
const QuantLib::Calendar& calendar,
const QuantLib::BusinessDayConvention& convention,
const double redemption,
const boost::shared_ptr<QuantLib::YieldTermStructure>& termStructure) {
QuantLib::Handle<QuantLib::YieldTermStructure> ts(termStructure);
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::ZeroCouponBond(issueDate,
maturityDate,
settlementDays,
dayCounter,
calendar,
convention,
redemption,
ts));
}
FixedCouponBond::FixedCouponBond(
const QuantLib::Date& issueDate,
const QuantLib::Date& datedDate,
const QuantLib::Date& maturityDate,
const long settlementDays,
const std::vector<double>& coupons,
const double redemption,
const QuantLib::Frequency& frequency,
const QuantLib::DayCounter& dayCounter,
const QuantLib::BusinessDayConvention& accrualConvention,
const QuantLib::BusinessDayConvention& paymentConvention,
const QuantLib::Calendar& calendar,
const bool startFromEnd,
const bool longFinal,
const boost::shared_ptr<QuantLib::YieldTermStructure>& termStructure) {
QuantLib::Handle<QuantLib::YieldTermStructure> ts(termStructure);
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::FixedCouponBond(issueDate,
datedDate,
maturityDate,
settlementDays,
coupons,
frequency,
calendar,
dayCounter,
accrualConvention,
paymentConvention,
redemption,
ts,
QuantLib::Date(),
startFromEnd,
longFinal));
}
}
Index: .cvsignore
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** .cvsignore 8 Jun 2006 18:42:42 -0000 1.3
--- .cvsignore 14 Jun 2006 18:34:31 -0000 1.4
***************
*** 9,12 ****
--- 9,13 ----
enumregistry.cpp
qladdin.hpp
+ vo_bonds.*pp
vo_calendar.*pp
vo_capfloor.*pp
***************
*** 14,18 ****
vo_exercise.*pp
vo_forwardrateagreement.*pp
- vo_instruments.*pp
vo_interpolation.*pp
vo_ohfunctions.*pp
--- 15,18 ----
Index: fixedcouponbond.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/fixedcouponbond.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** fixedcouponbond.cpp 9 Jun 2006 18:58:47 -0000 1.2
--- fixedcouponbond.cpp 14 Jun 2006 18:34:31 -0000 1.3
***************
*** 70,77 ****
startFromEnd,
longFinal
! #ifdef LOCAL_QL_PATCH
! ,
! nominals // Not yet implemented in QL
! #endif
));
}
--- 70,76 ----
startFromEnd,
longFinal
! #ifdef LOCAL_QL_PATCH
! , nominals // Not yet implemented in QL
! #endif
));
}
|