Coverage Report

Created: 2026-02-03 07:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/experimental/coupons/strippedcapflooredcoupon.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2014 Peter Caspers
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <https://www.quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
/*! \file strippedcapflooredcoupon.hpp
21
    \brief strips the embedded option from cap floored coupons
22
*/
23
24
#ifndef quantlib_stripped_capfloored_coupon_hpp
25
#define quantlib_stripped_capfloored_coupon_hpp
26
27
#include <ql/cashflows/capflooredcoupon.hpp>
28
29
namespace QuantLib {
30
31
    class StrippedCappedFlooredCoupon : public FloatingRateCoupon {
32
33
    public:
34
35
        explicit StrippedCappedFlooredCoupon(const ext::shared_ptr<CappedFlooredCoupon> &underlying);
36
37
        //! \name Obverver interface
38
        //@{
39
        void deepUpdate() override;
40
        //@}
41
42
        //! \name LazyObject interface
43
        //@{
44
        void performCalculations() const override;
45
        //@}
46
        //! Coupon interface
47
        Rate rate() const override;
48
        Rate convexityAdjustment() const override;
49
        //! cap
50
        Rate cap() const;
51
        //! floor
52
        Rate floor() const;
53
        //! effective cap
54
        Rate effectiveCap() const;
55
        //! effective floor
56
        Rate effectiveFloor() const;
57
58
        //! Visitability
59
        void accept(AcyclicVisitor&) override;
60
61
        bool isCap() const;
62
        bool isFloor() const;
63
        bool isCollar() const;
64
65
        void setPricer(const ext::shared_ptr<FloatingRateCouponPricer>& pricer) override;
66
67
0
        ext::shared_ptr<CappedFlooredCoupon> underlying() { return underlying_; }
68
69
      protected:
70
        ext::shared_ptr<CappedFlooredCoupon> underlying_;
71
72
    };
73
74
    class StrippedCappedFlooredCouponLeg {
75
      public:
76
        explicit StrippedCappedFlooredCouponLeg(Leg underlyingLeg);
77
        operator Leg() const;
78
      private:
79
        Leg underlyingLeg_;
80
    };
81
82
}
83
84
85
#endif