|
From: Bianchetti M. <mar...@ba...> - 2007-10-31 17:13:07
|
Why not under a dedicated folder /instruments/inflation/ ? M. > -----Original Message----- > From: qua...@li...=20 > [mailto:qua...@li...] On Behalf=20 > Of lba...@us... > Sent: 31 October 2007 17:09 > To: qua...@li... > Subject: [QuantLib-svn] SF.net SVN: quantlib:=20 > [13271]trunk/QuantLib/ql/instruments >=20 >=20 > Revision: 13271 > =20 > http://quantlib.svn.sourceforge.net/quantlib/?rev=3D13271&view=3Drev > Author: lballabio > Date: 2007-10-31 09:09:04 -0700 (Wed, 31 Oct 2007) >=20 > Log Message: > ----------- > Added inflation swaps (thanks to Chris Kenyon) >=20 > Modified Paths: > -------------- > trunk/QuantLib/ql/instruments/Makefile.am > trunk/QuantLib/ql/instruments/all.hpp >=20 > Added Paths: > ----------- > trunk/QuantLib/ql/instruments/inflationswap.cpp > trunk/QuantLib/ql/instruments/inflationswap.hpp > trunk/QuantLib/ql/instruments/yyiis.cpp > trunk/QuantLib/ql/instruments/yyiis.hpp > trunk/QuantLib/ql/instruments/zciis.cpp > trunk/QuantLib/ql/instruments/zciis.hpp >=20 > Modified: trunk/QuantLib/ql/instruments/Makefile.am > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/Makefile.am 2007-10-31=20 > 15:09:00 UTC (rev 13270) > +++ trunk/QuantLib/ql/instruments/Makefile.am 2007-10-31=20 > 16:09:04 UTC (rev 13271) > @@ -23,6 +23,7 @@ > forward.hpp \ > forwardrateagreement.hpp \ > forwardvanillaoption.hpp \ > + inflationswap.hpp \ > lookbackoption.hpp \ > makecapfloor.hpp \ > makecms.hpp \ > @@ -40,7 +41,9 @@ > swaption.hpp \ > vanillaoption.hpp \ > vanillaswap.hpp \ > - varianceswap.hpp > + varianceswap.hpp \ > + yyiis.hpp \ > + zciis.hpp > =20 > libInstruments_la_SOURCES =3D \ > asianoption.cpp \ > @@ -57,6 +60,7 @@ > forward.cpp \ > forwardrateagreement.cpp \ > forwardvanillaoption.cpp \ > + inflationswap.cpp \ > lookbackoption.cpp \ > makecapfloor.cpp \ > makecms.cpp \ > @@ -74,7 +78,9 @@ > swaption.cpp \ > vanillaoption.cpp \ > vanillaswap.cpp \ > - varianceswap.cpp > + varianceswap.cpp \ > + yyiis.cpp \ > + zciis.cpp > =20 > libInstruments_la_LIBADD =3D \ > bonds/libBonds.la >=20 > Modified: trunk/QuantLib/ql/instruments/all.hpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/all.hpp 2007-10-31=20 > 15:09:00 UTC (rev 13270) > +++ trunk/QuantLib/ql/instruments/all.hpp 2007-10-31=20 > 16:09:04 UTC (rev 13271) > @@ -18,6 +18,7 @@ > #include <ql/instruments/forward.hpp> > #include <ql/instruments/forwardrateagreement.hpp> > #include <ql/instruments/forwardvanillaoption.hpp> > +#include <ql/instruments/inflationswap.hpp> > #include <ql/instruments/lookbackoption.hpp> > #include <ql/instruments/makecapfloor.hpp> > #include <ql/instruments/makecms.hpp> > @@ -36,5 +37,7 @@ > #include <ql/instruments/vanillaoption.hpp> > #include <ql/instruments/vanillaswap.hpp> > #include <ql/instruments/varianceswap.hpp> > +#include <ql/instruments/yyiis.hpp> > +#include <ql/instruments/zciis.hpp> > =20 > #include <ql/instruments/bonds/all.hpp> >=20 > Added: trunk/QuantLib/ql/instruments/inflationswap.cpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/inflationswap.cpp =20 > (rev 0) > +++ trunk/QuantLib/ql/instruments/inflationswap.cpp=09 > 2007-10-31 16:09:04 UTC (rev 13271) > @@ -0,0 +1,67 @@ > +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil;=20 > c-basic-offset: 4 -*- */ > + > +/* > + Copyright (C) 2007 Chris Kenyon > + > + This file is part of QuantLib, a free-software/open-source library > + for financial quantitative analysts and developers -=20 > 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/license.shtml>. > + > + This program is distributed in the hope that it will be=20 > useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of=20 > MERCHANTABILITY or FITNESS > + FOR A PARTICULAR PURPOSE. See the license for more details. > +*/ > + > +#include <ql/instruments/inflationswap.hpp> > + > +namespace QuantLib { > + > + InflationSwap::InflationSwap(const Date& start, const=20 > Date& maturity, > + const Period& lag, const=20 > Calendar& calendar, > + BusinessDayConvention convention, > + const DayCounter& dayCounter, > + const=20 > Handle<YieldTermStructure>& yieldTS) > + : start_(start), maturity_(maturity), lag_(lag),=20 > calendar_(calendar), > + bdc_(convention), dayCounter_(dayCounter), yieldTS_(yieldTS) { > + > + baseDate_ =3D calendar_.adjust(start_ - lag_, bdc_); > + maturity_ =3D calendar_.adjust(maturity_, bdc_); > + > + registerWith(yieldTS_); > + } > + > + Date InflationSwap::baseDate() const { > + return baseDate_; > + } > + > + Period InflationSwap::lag() const { > + return lag_; > + } > + > + Date InflationSwap::startDate() const { > + return start_; > + } > + > + Date InflationSwap::maturityDate() const { > + return maturity_; > + } > + > + Calendar InflationSwap::calendar() const { > + return calendar_; > + } > + > + BusinessDayConvention=20 > InflationSwap::businessDayConvention() const { > + return bdc_; > + } > + > + DayCounter InflationSwap::dayCounter() const { > + return dayCounter_; > + } > + > +} > + >=20 >=20 > Property changes on: trunk/QuantLib/ql/instruments/inflationswap.cpp > ___________________________________________________________________ > Name: svn:eol-style > + native >=20 > Added: trunk/QuantLib/ql/instruments/inflationswap.hpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/inflationswap.hpp =20 > (rev 0) > +++ trunk/QuantLib/ql/instruments/inflationswap.hpp=09 > 2007-10-31 16:09:04 UTC (rev 13271) > @@ -0,0 +1,75 @@ > +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil;=20 > c-basic-offset: 4 -*- */ > + > +/* > + Copyright (C) 2007 Chris Kenyon > + > + This file is part of QuantLib, a free-software/open-source library > + for financial quantitative analysts and developers -=20 > 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/license.shtml>. > + > + This program is distributed in the hope that it will be=20 > useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of=20 > MERCHANTABILITY or FITNESS > + FOR A PARTICULAR PURPOSE. See the license for more details. > +*/ > + > +/*! \file inflationswap.hpp > + \brief Abstract base class for inflation swaps > +*/ > + > +#ifndef quantlib_inflation_swap_hpp > +#define quantlib_inflation_swap_hpp > + > +#include <ql/instrument.hpp> > +#include <ql/termstructures/inflationtermstructure.hpp> > + > +namespace QuantLib { > + > + //! Abstract base class for inflation swaps. > + /*! Inflation swaps need two term structures: > + - nominal > + - inflation (either zero-coupon or year-on-year) > + > + \ingroup instruments > + */ > + class InflationSwap : public Instrument { > + public: > + //! the constructor sets common data members > + InflationSwap(const Date& start, const Date& maturity, > + const Period& lag, const Calendar& calendar, > + BusinessDayConvention convention, > + const DayCounter& dayCounter, > + const Handle<YieldTermStructure>& yieldTS); > + //! \name Inspectors > + /*! The inflation rate is taken relative to the base date, > + which is a lag period before the start date of the swap. > + */ > + //@{ > + Date baseDate() const; > + Period lag() const; > + Date startDate() const; > + Date maturityDate() const; > + Calendar calendar() const; > + BusinessDayConvention businessDayConvention() const; > + DayCounter dayCounter() const; > + //@} > + virtual Rate fairRate() const =3D 0; > + protected: > + Date start_; > + Date maturity_; > + Period lag_; > + Calendar calendar_; > + BusinessDayConvention bdc_; > + DayCounter dayCounter_; > + Handle<YieldTermStructure> yieldTS_; > + Date baseDate_; > + }; > + > +} > + > + > +#endif >=20 >=20 > Property changes on: trunk/QuantLib/ql/instruments/inflationswap.hpp > ___________________________________________________________________ > Name: svn:eol-style > + native >=20 > Added: trunk/QuantLib/ql/instruments/yyiis.cpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/yyiis.cpp =20 > (rev 0) > +++ trunk/QuantLib/ql/instruments/yyiis.cpp 2007-10-31=20 > 16:09:04 UTC (rev 13271) > @@ -0,0 +1,133 @@ > +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil;=20 > c-basic-offset: 4 -*- */ > + > +/* > + Copyright (C) 2007 Chris Kenyon > + > + This file is part of QuantLib, a free-software/open-source library > + for financial quantitative analysts and developers -=20 > 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/license.shtml>. > + > + This program is distributed in the hope that it will be=20 > useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of=20 > MERCHANTABILITY or FITNESS > + FOR A PARTICULAR PURPOSE. See the license for more details. > +*/ > + > +#include <ql/instruments/yyiis.hpp> > +#include <ql/time/schedule.hpp> > + > +namespace QuantLib { > + > + > + YearOnYearInflationSwap::YearOnYearInflationSwap( > + const Date& start, > + const Date& maturity, > + const Period& lag, > + Rate fixedRate, > + const Calendar& calendar, > + BusinessDayConvention convention, > + const DayCounter& dayCounter, > + const Handle<YieldTermStructure>& yieldTS, > + const Handle<YoYInflationTermStructure>&=20 > inflationTS, > + bool allowAmbiguousPayments, > + const Period& ambiguousPaymentPeriod) > + : InflationSwap(start, maturity, lag, calendar, convention, > + dayCounter, yieldTS), > + fixedRate_(fixedRate), inflationTS_(inflationTS), > + allowAmbiguousPayments_(allowAmbiguousPayments), > + ambiguousPaymentPeriod_(ambiguousPaymentPeriod) { > + > + Schedule temp =3D MakeSchedule(start_, maturity_, > + Period(1,Years), > + calendar_, bdc_); > + paymentDates_.clear(); > + paymentDates_.reserve(temp.size()-1); > + > + // the first payment date is the _second_ date in=20 > the schedule, > + // so we start from index 1 > + for (Size i=3D1; i<temp.size(); ++i) { > + if (!allowAmbiguousPayments_) { > + if (temp[i] > start_ + ambiguousPaymentPeriod_) { > + paymentDates_.push_back(temp[i]); > + } > + } else { > + paymentDates_.push_back(temp[i]); > + } > + } > + > + QL_REQUIRE(!paymentDates_.empty(), > + " no payments dates, start " << start_ > + << ", maturity: " << maturity_); > + } > + > + > + bool YearOnYearInflationSwap::isExpired() const { > + return yieldTS_->referenceDate() > maturity_; > + } > + > + > + Rate YearOnYearInflationSwap::fairRate() const { > + calculate(); > + return fairRate_; > + } > + > + > + Rate YearOnYearInflationSwap::fixedRate() const { > + return fixedRate_; > + } > + > + > + std::vector<Date> YearOnYearInflationSwap::paymentDates() const { > + return paymentDates_; > + } > + > + > + void YearOnYearInflationSwap::setupExpired() const { > + Instrument::setupExpired(); > + fairRate_ =3D Null<Rate>(); > + } > + > + > + void YearOnYearInflationSwap::performCalculations() const { > + // Rates for instruments always look at earlier=20 > values paid later. > + Real nom =3D 0.0; > + Real inf1 =3D 0.0; > + Real inf2 =3D 0.0; > + Real frac; > + > + Date referenceDate =3D yieldTS_->referenceDate(); > + for (Size i=3D0; i<paymentDates_.size(); i++) { > + Date couponPayDate =3D paymentDates_[i]; > + if (couponPayDate >=3D referenceDate) { > + if (i=3D=3D0) { > + frac =3D dayCounter_.yearFraction(referenceDate, > + couponPayDate); > + } else { > + if (referenceDate > paymentDates_[i-1]) > + frac =3D=20 > dayCounter_.yearFraction(referenceDate, > + =20 > couponPayDate); > + else > + frac =3D=20 > dayCounter_.yearFraction(paymentDates_[i-1], > + =20 > couponPayDate); > + } > + > + nom +=3D frac * yieldTS_->discount(couponPayDate); > + inf1 +=3D frac * inflationTS_->yoyRate( > + calendar().adjust(couponPayDate=20 > - lag(), bdc_)); > + inf2 +=3D frac * inflationTS_->yoyRate( > + calendar().adjust(couponPayDate=20 > - lag(), bdc_)) * > + yieldTS_->discount(couponPayDate); > + } > + } > + > + NPV_ =3D nom*fixedRate_ - inf1; > + errorEstimate_ =3D 0.0; > + fairRate_ =3D inf2/nom; > + } > + > +} > + >=20 >=20 > Property changes on: trunk/QuantLib/ql/instruments/yyiis.cpp > ___________________________________________________________________ > Name: svn:eol-style > + native >=20 > Added: trunk/QuantLib/ql/instruments/yyiis.hpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/yyiis.hpp =20 > (rev 0) > +++ trunk/QuantLib/ql/instruments/yyiis.hpp 2007-10-31=20 > 16:09:04 UTC (rev 13271) > @@ -0,0 +1,90 @@ > +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil;=20 > c-basic-offset: 4 -*- */ > + > +/* > + Copyright (C) 2007 Chris Kenyon > + > + This file is part of QuantLib, a free-software/open-source library > + for financial quantitative analysts and developers -=20 > 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/license.shtml>. > + > + This program is distributed in the hope that it will be=20 > useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of=20 > MERCHANTABILITY or FITNESS > + FOR A PARTICULAR PURPOSE. See the license for more details. > +*/ > + > +/*! \file yyiis.hpp > + \brief Year-on-year inflation-indexed swap > +*/ > + > +#ifndef quantlib_yyiis_hpp > +#define quantlib_yyiis_hpp > + > +#include <ql/instruments/inflationswap.hpp> > + > +namespace QuantLib { > + > + //! Year-on-year inflation-indexed swap > + /*! \note The allowAmbiguousPayments parameter is to allow for > + payment arithmetic being ambiguous. If the maturity is > + in, say, 30.01 years according to the daycounter and > + roll rules does this mean that there is a payment in > + 0.01 years?. > + */ > + class YearOnYearInflationSwap : public InflationSwap { > + public: > + YearOnYearInflationSwap( > + const Date& start, > + const Date& maturity, > + const Period& lag, > + Rate fixedRate, > + const Calendar& calendar, > + BusinessDayConvention convention, > + const DayCounter& dayCounter, > + const Handle<YieldTermStructure>& yieldTS, > + const Handle<YoYInflationTermStructure>&=20 > inflationTS, > + bool allowAmbiguousPayments =3D false, > + const Period& ambiguousPaymentPeriod =3D=20 > Period(1, Months)); > + > + //! \name Instrument interface > + //@{ > + bool isExpired() const; > + //@} > + > + //! \name InflationSwap interface > + //@{ > + Rate fairRate() const; > + //@} > + > + //! \name Inspectors > + //@{ > + Rate fixedRate() const; > + std::vector<Date> paymentDates() const; > + //@} > + > + protected: > + //! \name Instrument interface > + //@{ > + void setupExpired() const; > + void performCalculations() const; > + //@} > + > + Rate fixedRate_; > + Handle<YoYInflationTermStructure> inflationTS_; > + > + bool allowAmbiguousPayments_; > + Period ambiguousPaymentPeriod_; > + std::vector<Date> paymentDates_; > + > + mutable Rate fairRate_; > + }; > + > +} > + > + > +#endif > + >=20 >=20 > Property changes on: trunk/QuantLib/ql/instruments/yyiis.hpp > ___________________________________________________________________ > Name: svn:eol-style > + native >=20 > Added: trunk/QuantLib/ql/instruments/zciis.cpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/zciis.cpp =20 > (rev 0) > +++ trunk/QuantLib/ql/instruments/zciis.cpp 2007-10-31=20 > 16:09:04 UTC (rev 13271) > @@ -0,0 +1,68 @@ > +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil;=20 > c-basic-offset: 4 -*- */ > + > +/* > + Copyright (C) 2007 Chris Kenyon > + > + This file is part of QuantLib, a free-software/open-source library > + for financial quantitative analysts and developers -=20 > 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/license.shtml>. > + > + This program is distributed in the hope that it will be=20 > useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of=20 > MERCHANTABILITY or FITNESS > + FOR A PARTICULAR PURPOSE. See the license for more details. > +*/ > + > +#include <ql/instruments/zciis.hpp> > + > +namespace QuantLib { > + > + ZeroCouponInflationSwap::ZeroCouponInflationSwap( > + const Date& start, > + const Date& maturity, > + const Period &lag, > + Rate fixedRate, > + const Calendar& calendar, > + BusinessDayConvention convention, > + const DayCounter& dayCounter, > + const Handle<YieldTermStructure>& yieldTS, > + const=20 > Handle<ZeroInflationTermStructure>& inflationTS) > + : InflationSwap(start, maturity, lag, calendar, convention, > + dayCounter, yieldTS), > + fixedRate_(fixedRate), inflationTS_(inflationTS) { > + registerWith(inflationTS_); > + } > + > + > + bool ZeroCouponInflationSwap::isExpired() const { > + return yieldTS_->referenceDate() > maturity_; > + } > + > + > + Rate ZeroCouponInflationSwap::fairRate() const { > + return inflationTS_->zeroRate(maturity_ - lag_); > + } > + > + > + Rate ZeroCouponInflationSwap::fixedRate() const { > + return fixedRate_; > + } > + > + > + void ZeroCouponInflationSwap::performCalculations() const { > + > + // the observation lag is also taken into account in=20 > fairRate(); > + // discount is relative to the payment date, not the=20 > observation date. > + Real T =3D dayCounter_.yearFraction(inflationTS_->baseDate(), > + maturity_ - lag_); > + NPV_ =3D yieldTS_->discount(maturity_) * > + (std::pow(1.0 + fixedRate_, T) - std::pow(1.0 +=20 > fairRate(), T)); > + errorEstimate_ =3D 0.0; > + } > + > +} > + >=20 >=20 > Property changes on: trunk/QuantLib/ql/instruments/zciis.cpp > ___________________________________________________________________ > Name: svn:eol-style > + native >=20 > Added: trunk/QuantLib/ql/instruments/zciis.hpp > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- trunk/QuantLib/ql/instruments/zciis.hpp =20 > (rev 0) > +++ trunk/QuantLib/ql/instruments/zciis.hpp 2007-10-31=20 > 16:09:04 UTC (rev 13271) > @@ -0,0 +1,78 @@ > +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil;=20 > c-basic-offset: 4 -*- */ > + > +/* > + Copyright (C) 2007 Chris Kenyon > + > + This file is part of QuantLib, a free-software/open-source library > + for financial quantitative analysts and developers -=20 > 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/license.shtml>. > + > + This program is distributed in the hope that it will be=20 > useful, but WITHOUT > + ANY WARRANTY; without even the implied warranty of=20 > MERCHANTABILITY or FITNESS > + FOR A PARTICULAR PURPOSE. See the license for more details. > +*/ > + > +/*! \file zciis.hpp > + \brief Zero-coupon inflation-indexed swap > +*/ > + > +#ifndef quantlib_zciis_hpp > +#define quantlib_zciis_hpp > + > +#include <ql/instruments/inflationswap.hpp> > + > +namespace QuantLib { > + > + //! Zero-coupon inflation-indexed swap > + /*! A ZCIIS pays a fixed rate and receives the inflation rate at > + date \f$ d2 \f$ relative to inflation at date \f$ d1 \f$, > + where \f$ d1 \f$ is a lag period before start date=20 > and \f$ d2 \f$ > + is a lag period before maturity. > + */ > + class ZeroCouponInflationSwap : public InflationSwap { > + public: > + ZeroCouponInflationSwap( > + const Date& start, > + const Date& maturity, > + const Period& lag, > + Rate fixedRate, > + const Calendar& calendar, > + BusinessDayConvention convention, > + const DayCounter& dayCounter, > + const Handle<YieldTermStructure>& yieldTS, > + const=20 > Handle<ZeroInflationTermStructure>& inflationTS); > + > + //! \name Instrument interface > + //@{ > + bool isExpired() const; > + //@} > + > + //! \name InflationSwap interface > + //@{ > + Rate fairRate() const; > + //@} > + > + //! \name Inspectors > + //@{ > + Rate fixedRate() const; > + //@} > + > + protected: > + //! \name Instrument interface > + //@{ > + void performCalculations() const; > + //@} > + > + Rate fixedRate_; > + Handle<ZeroInflationTermStructure> inflationTS_; > + }; > + > +} > + > + > +#endif >=20 >=20 > Property changes on: trunk/QuantLib/ql/instruments/zciis.hpp > ___________________________________________________________________ > Name: svn:eol-style > + native >=20 >=20 > This was sent by the SourceForge.net collaborative=20 > development platform, the world's largest Open Source=20 > development site. >=20 > -------------------------------------------------------------- > ----------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and=20 > a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > QuantLib-cvs mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-cvs >=20 |