Logo Search packages:      
Sourcecode: quantlib version File versions  Download package


Go to the documentation of this file.
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

 Copyright (C) 2009 Chris Kenyon

 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
 <quantlib-dev@lists.sf.net>. The license is also available online at

 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.

/*! \file yoyinflationcoupon.hpp
 \brief Coupon paying a yoy inflation index

#ifndef quantlib_newyoy_coupon_hpp
#define quantlib_newyoy_coupon_hpp

#include <ql/cashflows/inflationcoupon.hpp>
#include <ql/indexes/inflationindex.hpp>
#include <ql/time/schedule.hpp>

namespace QuantLib {
    class YoYInflationCouponPricer;

    //! %Coupon paying a YoY-inflation type index
00035     class YoYInflationCoupon : public InflationCoupon {
        YoYInflationCoupon(const Date& paymentDate,
                        Real nominal,
                        const Date& startDate,
                        const Date& endDate,
                        Natural fixingDays,
                        const boost::shared_ptr<YoYInflationIndex>& index,
                        const Period& observationLag,
                        const DayCounter& dayCounter,
                        Real gearing = 1.0,
                        Spread spread = 0.0,
                        const Date& refPeriodStart = Date(),
                        const Date& refPeriodEnd = Date()

        //! \name Inspectors
        //! index gearing, i.e. multiplicative coefficient for the index
00054         Real gearing() const { return gearing_; }
        //! spread paid over the fixing of the underlying index
00056         Spread spread() const { return spread_; }

        Rate adjustedFixing() const;

        const boost::shared_ptr<YoYInflationIndex>& yoyIndex() const;

        //! \name Visitability
        virtual void accept(AcyclicVisitor&);

        boost::shared_ptr<YoYInflationIndex> yoyIndex_;

        Real gearing_;
        Spread spread_;
        bool checkPricerImpl(const boost::shared_ptr<InflationCouponPricer>&) const;

    inline const boost::shared_ptr<YoYInflationIndex>&
    YoYInflationCoupon::yoyIndex() const {
        return yoyIndex_;

    inline Rate YoYInflationCoupon::adjustedFixing() const {
        return (rate()-spread())/gearing();

    //! Helper class building a sequence of capped/floored yoy inflation coupons
    //! payoff is: spread + gearing x index
00091     class yoyInflationLeg {
        yoyInflationLeg(const Schedule& schedule, const Calendar& cal,
                        const boost::shared_ptr<YoYInflationIndex>& index,
                        const Period& observationLag);
        yoyInflationLeg& withNotionals(Real notional);
        yoyInflationLeg& withNotionals(const std::vector<Real>& notionals);
        yoyInflationLeg& withPaymentDayCounter(const DayCounter&);
        yoyInflationLeg& withPaymentAdjustment(BusinessDayConvention);
        yoyInflationLeg& withFixingDays(Natural fixingDays);
        yoyInflationLeg& withFixingDays(const std::vector<Natural>& fixingDays);
        yoyInflationLeg& withGearings(Real gearing);
        yoyInflationLeg& withGearings(const std::vector<Real>& gearings);
        yoyInflationLeg& withSpreads(Spread spread);
        yoyInflationLeg& withSpreads(const std::vector<Spread>& spreads);
        yoyInflationLeg& withCaps(Rate cap);
        yoyInflationLeg& withCaps(const std::vector<Rate>& caps);
        yoyInflationLeg& withFloors(Rate floor);
        yoyInflationLeg& withFloors(const std::vector<Rate>& floors);
        operator Leg() const;
        Schedule schedule_;
        boost::shared_ptr<YoYInflationIndex> index_;
        Period observationLag_;
        std::vector<Real> notionals_;
        DayCounter paymentDayCounter_;
        BusinessDayConvention paymentAdjustment_;
        Calendar paymentCalendar_;
        std::vector<Natural> fixingDays_;
        std::vector<Real> gearings_;
        std::vector<Spread> spreads_;
        std::vector<Rate> caps_, floors_;



Generated by  Doxygen 1.6.0   Back to index