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) 2003 Nicolas Di Césaré

 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 indexedcoupon.hpp
    \brief indexed coupon

#ifndef quantlib_indexed_coupon_hpp
#define quantlib_indexed_coupon_hpp

#include <ql/CashFlows/floatingratecoupon.hpp>
#include <ql/Indexes/xibor.hpp>

namespace QuantLib {

    //! Base indexed coupon class
    /*! \warning This class does not perform any date adjustment,
                 i.e., the start and end date passed upon construction
                 should be already rolled to a business day.
00037     class IndexedCoupon : public FloatingRateCoupon,
                          public Observer {
        IndexedCoupon(Real nominal,
                      const Date& paymentDate,
                      const boost::shared_ptr<Index>& index,
                      const Date& startDate, const Date& endDate,
                      Integer fixingDays,
                      Spread spread = 0.0,
                      const Date& refPeriodStart = Date(),
                      const Date& refPeriodEnd = Date(),
                      const DayCounter& dayCounter = DayCounter());
        virtual ~IndexedCoupon() {}
        //! \name CashFlow interface
        Real amount() const;
        //! \name Coupon interface
00056         DayCounter dayCounter() const { return dayCounter_; }
        //! \name FloatingRateCoupon interface
        Rate indexFixing() const;
        //! \name Inspectors
        const boost::shared_ptr<Index>& index() const;
        //! \name Observer interface
        void update();
        //! \name Visitability
        virtual void accept(AcyclicVisitor&);
        boost::shared_ptr<Index> index_;
        DayCounter dayCounter_;

    // inline definitions
    inline IndexedCoupon::IndexedCoupon(Real nominal,
                                        const Date& paymentDate,
                                        const boost::shared_ptr<Index>& index,
                                        const Date& startDate,
                                        const Date& endDate,
                                        Integer fixingDays, Spread spread,
                                        const Date& refPeriodStart,
                                        const Date& refPeriodEnd,
                                        const DayCounter& dayCounter)
    : FloatingRateCoupon(nominal, paymentDate, startDate, endDate,
                         fixingDays, spread, refPeriodStart, refPeriodEnd),
      index_(index), dayCounter_(dayCounter) {
        if (dayCounter_.isNull()) {
            boost::shared_ptr<Xibor> xibor =
            if (xibor)
                dayCounter_ = xibor->dayCounter();
                QL_FAIL("day counter not specified and not retrievable "
                        "from index");

    inline const boost::shared_ptr<Index>&
    IndexedCoupon::index() const {
        return index_;

00111     inline Rate IndexedCoupon::indexFixing() const {
        return index_->fixing(fixingDate());

00115     inline Real IndexedCoupon::amount() const {
        return rate() * accrualPeriod() * nominal();

00119     inline void IndexedCoupon::update() {

    inline void IndexedCoupon::accept(AcyclicVisitor& v) {
        Visitor<IndexedCoupon>* v1 =
        if (v1 != 0)



Generated by  Doxygen 1.6.0   Back to index