Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cappedflooredaveragebmacoupon.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 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 cappedflooredaveragebmacoupon.hpp
20 \brief coupon paying a capped / floored average bma rate
21 \ingroup cashflows
22*/
23
24#pragma once
25
26#include <ql/cashflows/averagebmacoupon.hpp>
27#include <ql/cashflows/couponpricer.hpp>
28
29namespace QuantExt {
30using namespace QuantLib;
31
33public:
34 CappedFlooredAverageBMACoupon(const ext::shared_ptr<AverageBMACoupon>& underlying, Real cap = Null<Real>(),
35 Real floor = Null<Real>(), bool nakedOption = false, bool includeSpread = false);
36
37 //! \name Observer interface
38 //@{
39 void deepUpdate() override;
40 //@}
41 //! \name LazyObject interface
42 //@{
43 void performCalculations() const override;
44 void alwaysForwardNotifications() override;
45 //@}
46 //! \name Coupon interface
47 //@{
48 Rate rate() const override;
49 Rate convexityAdjustment() const override;
50 //@}
51 //! \name FloatingRateCoupon interface
52 //@{
53 Date fixingDate() const override { return underlying_->fixingDate(); }
54 //@}
55 //! cap
56 Rate cap() const;
57 //! floor
58 Rate floor() const;
59 //! effective cap of fixing
60 Rate effectiveCap() const;
61 //! effective floor of fixing
62 Rate effectiveFloor() const;
63 //! effective caplet volatility
64 Real effectiveCapletVolatility() const;
65 //! effective floorlet volatility
66 Real effectiveFloorletVolatility() const;
67 //@}
68 //! \name Visitability
69 //@{
70 virtual void accept(AcyclicVisitor&) override;
71
72 bool isCapped() const { return cap_ != Null<Real>(); }
73 bool isFloored() const { return floor_ != Null<Real>(); }
74
75 ext::shared_ptr<AverageBMACoupon> underlying() const { return underlying_; }
76 bool nakedOption() const { return nakedOption_; }
77 bool includeSpread() const { return includeSpread_; }
78
79protected:
80 ext::shared_ptr<AverageBMACoupon> underlying_;
81 Rate cap_, floor_;
86};
87
88//! capped floored averaged indexed coupon pricer base class
89class CapFlooredAverageBMACouponPricer : public FloatingRateCouponPricer {
90public:
91 CapFlooredAverageBMACouponPricer(const Handle<OptionletVolatilityStructure>& v,
92 const bool effectiveVolatilityInput = false);
93 Handle<OptionletVolatilityStructure> capletVolatility() const;
94 bool effectiveVolatilityInput() const;
95 Real effectiveCapletVolatility() const; // only available after capletRate() was called
96 Real effectiveFloorletVolatility() const; // only available after floorletRate() was called
97
98protected:
99 Handle<OptionletVolatilityStructure> capletVol_;
103};
104
105} // namespace QuantExt
capped floored averaged indexed coupon pricer base class
Handle< OptionletVolatilityStructure > capletVolatility() const
Handle< OptionletVolatilityStructure > capletVol_
Real effectiveCapletVolatility() const
effective caplet volatility
ext::shared_ptr< AverageBMACoupon > underlying_
virtual void accept(AcyclicVisitor &) override
Real effectiveFloorletVolatility() const
effective floorlet volatility
Rate effectiveCap() const
effective cap of fixing
ext::shared_ptr< AverageBMACoupon > underlying() const
Rate effectiveFloor() const
effective floor of fixing