Logo Search packages:      
Sourcecode: quantlib version File versions


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

 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
 Copyright (C) 2003, 2004 StatPro Italia srl

 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 fixedratecoupon.hpp
    \brief Coupon paying a fixed annual rate

#ifndef quantlib_fixed_rate_coupon_hpp
#define quantlib_fixed_rate_coupon_hpp

#include <ql/CashFlows/coupon.hpp>

namespace QuantLib {

    //! %Coupon paying a fixed interest rate
00033     class FixedRateCoupon : public Coupon {
        FixedRateCoupon(Real nominal,
                        const Date& paymentDate,
                        Rate rate,
                        const DayCounter& dayCounter,
                        const Date& startDate, const Date& endDate,
                        const Date& refPeriodStart = Date(),
                        const Date& refPeriodEnd = Date())
        : Coupon(nominal, paymentDate, startDate, endDate,
                 refPeriodStart, refPeriodEnd),
          rate_(rate), dayCounter_(dayCounter) {}
        //! \name CashFlow interface
        Real amount() const;
        //! \name Coupon interface
        Rate rate() const;
00052         DayCounter dayCounter() const { return dayCounter_; }
        Real accruedAmount(const Date&) const;
        //! \name Visitability
        virtual void accept(AcyclicVisitor&);
        Rate rate_;
        DayCounter dayCounter_;

    // inline definitions

00067     inline Real FixedRateCoupon::amount() const {
        return nominal()*rate_*accrualPeriod();

00071     inline Rate FixedRateCoupon::rate() const {
        return rate_;

00075     inline Real FixedRateCoupon::accruedAmount(const Date& d) const {
        if (d <= accrualStartDate_ || d > paymentDate_) {
            return 0.0;
        } else {
            return nominal()*rate_*

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



Generated by  Doxygen 1.6.0   Back to index