Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
floatingannuitycoupon.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file floatingannuitycoupon.hpp
20 \brief Coupon paying a Libor-type index
21 \ingroup cashflows
22*/
23
24#ifndef quantext_floating_annuity_coupon_hpp
25#define quantext_floating_annuity_coupon_hpp
26
27#include <ql/cashflows/floatingratecoupon.hpp>
28#include <ql/indexes/iborindex.hpp>
29#include <ql/patterns/lazyobject.hpp>
30#include <ql/time/schedule.hpp>
31
32namespace QuantExt {
33using namespace QuantLib;
34//! floating annuity coupon
35/*! %Coupon paying a Libor-type index on a variable nominal such that total flows are constant
36 \ingroup cashflows
37*/
38class FloatingAnnuityCoupon : public Coupon, public LazyObject {
39public:
40 FloatingAnnuityCoupon(Real annuity, bool underflow, const QuantLib::ext::shared_ptr<Coupon>& previousCoupon,
41 const Date& paymentDate, const Date& startDate, const Date& endDate, Natural fixingDays,
42 const QuantLib::ext::shared_ptr<InterestRateIndex>& index, Real gearing = 1.0, Spread spread = 0.0,
43 const Date& refPeriodStart = Date(), const Date& refPeriodEnd = Date(),
44 const DayCounter& dayCounter = DayCounter(), bool isInArrears = false);
45 //! \name Cashflow interface
46 Rate amount() const override;
47
48 //! \name Inspectors
49 Real accruedAmount(const Date& d) const override;
50 Rate nominal() const override;
51 Rate previousNominal() const;
52 Rate rate() const override;
53 Real price(const Handle<YieldTermStructure>& discountingCurve) const;
54 const QuantLib::ext::shared_ptr<InterestRateIndex>& index() const;
55 DayCounter dayCounter() const override;
56 Rate indexFixing() const;
57 Natural fixingDays() const;
58 Date fixingDate() const;
59 Real gearing() const;
60 Spread spread() const;
61 virtual Rate convexityAdjustment() const { return 0.0; } // FIXME
62 virtual Rate adjustedFixing() const { return indexFixing(); } // FIXME
63 bool isInArrears() const;
64 //@}
65 //! \name Visitor interface
66 //@{
67 virtual void accept(AcyclicVisitor&) override;
68 //@}
69 //! \name LazyObject interface
70 void performCalculations() const override;
71
72private:
75 QuantLib::ext::shared_ptr<Coupon> previousCoupon_;
76 mutable Real nominal_;
77
78 // floating rate coupon members
80 QuantLib::ext::shared_ptr<InterestRateIndex> index_;
82 Real spread_;
83 DayCounter dayCounter_;
85};
86
87inline const QuantLib::ext::shared_ptr<InterestRateIndex>& FloatingAnnuityCoupon::index() const { return index_; }
88
89inline DayCounter FloatingAnnuityCoupon::dayCounter() const { return dayCounter_; }
90
91inline Natural FloatingAnnuityCoupon::fixingDays() const { return fixingDays_; }
92
93inline Real FloatingAnnuityCoupon::gearing() const { return gearing_; }
94
95inline Spread FloatingAnnuityCoupon::spread() const { return spread_; }
96
97inline bool FloatingAnnuityCoupon::isInArrears() const { return isInArrears_; }
98} // namespace QuantExt
99
100#endif
QuantLib::ext::shared_ptr< Coupon > previousCoupon_
const QuantLib::ext::shared_ptr< InterestRateIndex > & index() const
QuantLib::ext::shared_ptr< InterestRateIndex > index_
virtual void accept(AcyclicVisitor &) override
DayCounter dayCounter() const override
Real price(const Handle< YieldTermStructure > &discountingCurve) const
Real accruedAmount(const Date &d) const override