Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
strippedcapflooredcpicoupon.hpp
Go to the documentation of this file.
1/*
2Copyright (C) 2019 Quaternion Risk Management Ltd
3All rights reserved.
4
5This file is part of ORE, a free-software/open-source library
6for transparent pricing and risk analysis - http://opensourcerisk.org
7
8ORE is free software: you can redistribute it and/or modify it
9under the terms of the Modified BSD License. You should have received a
10copy of the license along with this program.
11The license is also available online at <http://opensourcerisk.org>
12
13This program is distributed on the basis that it will form a useful
14contribution to risk analytics and model standardisation, but WITHOUT
15ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file strippedcapflooredcpicoupon.hpp
20\brief strips the embedded option from cap floored cpi coupons
21*/
22
23#ifndef quantext_stripped_capfloored_cpicoupon_hpp
24#define quantext_stripped_capfloored_cpicoupon_hpp
25
26#include <ql/cashflows/inflationcouponpricer.hpp>
28
29namespace QuantExt {
30using namespace QuantLib;
31
33
34public:
35 explicit StrippedCappedFlooredCPICoupon(const ext::shared_ptr<CappedFlooredCPICoupon>& underlying);
36 //! Coupon interface
37 Rate rate() const override;
38 Rate cap() const;
39 Rate floor() const;
40 Rate effectiveCap() const;
41 Rate effectiveFloor() const;
42
43 //! Observer interface
44 void update() override;
45 //! Visitability
46 virtual void accept(AcyclicVisitor&) override;
47
48 //! Underlying coupon
49 const ext::shared_ptr<CappedFlooredCPICoupon> underlying() { return underlying_; }
50
51 bool isCap() const;
52 bool isFloor() const;
53 bool isCollar() const;
54
55protected:
56 ext::shared_ptr<CappedFlooredCPICoupon> underlying_;
57};
58
59//! Stripped capped or floored CPI cashflow.
60/*! Extended QuantLib::CPICashFlow
61 */
62class StrippedCappedFlooredCPICashFlow : public CPICashFlow {
63public:
64 StrippedCappedFlooredCPICashFlow(const ext::shared_ptr<CappedFlooredCPICashFlow>& underlying);
65 //! Cashflow interface
66 Real amount() const override;
67 //! Underlying cash flow
68 ext::shared_ptr<CappedFlooredCPICashFlow> underlying() const { return underlying_; }
69
70private:
71 ext::shared_ptr<CappedFlooredCPICashFlow> underlying_;
72};
73
75public:
76 explicit StrippedCappedFlooredCPICouponLeg(const Leg& underlyingLeg);
77 operator Leg() const;
78
79private:
81};
82
83} // namespace QuantExt
84
85#endif
Stripped capped or floored CPI cashflow.
ext::shared_ptr< CappedFlooredCPICashFlow > underlying() const
Underlying cash flow.
Real amount() const override
Cashflow interface.
ext::shared_ptr< CappedFlooredCPICashFlow > underlying_
Rate rate() const override
Coupon interface.
virtual void accept(AcyclicVisitor &) override
Visitability.
ext::shared_ptr< CappedFlooredCPICoupon > underlying_
const ext::shared_ptr< CappedFlooredCPICoupon > underlying()
Underlying coupon.
CPI leg builder extending QuantLib's to handle caps and floors.