Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cpicouponpricer.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 cpicouponpricer.hpp
20 \brief CPI cash flow and coupon pricers that handle caps/floors using a CpiCapFloorEngine
21*/
22
23#ifndef quantext_cpicouponpricer_hpp
24#define quantext_cpicouponpricer_hpp
25
26#include <ql/cashflows/cpicouponpricer.hpp>
27#include <ql/cashflows/inflationcouponpricer.hpp>
28#include <ql/option.hpp>
29#include <ql/termstructures/volatility/inflation/cpivolatilitystructure.hpp>
30#include <ql/termstructures/yield/flatforward.hpp>
31#include <ql/time/daycounters/actual365fixed.hpp>
32#include <ql/time/schedule.hpp>
34
35namespace QuantExt {
36using namespace QuantLib;
37
38//! Base class for CPI CashFLow and Coupon pricers
39class InflationCashFlowPricer : public virtual Observer, public virtual Observable {
40public:
41 InflationCashFlowPricer(const Handle<QuantLib::CPIVolatilitySurface>& vol = Handle<QuantLib::CPIVolatilitySurface>(),
42 const Handle<YieldTermStructure>& yts = Handle<YieldTermStructure>());
44
45 //! Inspectors
46 //@{
47 Handle<QuantLib::CPIVolatilitySurface> volatility() { return vol_; }
48 Handle<YieldTermStructure> yieldCurve() { return yts_; }
49 QuantLib::ext::shared_ptr<PricingEngine> engine() { return engine_; }
50 //@}
51
52 //! \name Observer interface
53 //@{
54 virtual void update() override { notifyObservers(); }
55 //@}
56protected:
57 Handle<QuantLib::CPIVolatilitySurface> vol_;
58 Handle<YieldTermStructure> yts_;
59 QuantLib::ext::shared_ptr<PricingEngine> engine_;
60};
61
62//! Black CPI CashFlow Pricer.
64public:
65 BlackCPICashFlowPricer(const Handle<QuantLib::CPIVolatilitySurface>& vol = Handle<QuantLib::CPIVolatilitySurface>(),
66 const Handle<YieldTermStructure>& yts = Handle<YieldTermStructure>(),
67 const bool useLastFixing = false);
68};
69
70//! Bachelier CPI CashFlow Pricer.
72public:
74 const Handle<QuantLib::CPIVolatilitySurface>& vol = Handle<QuantLib::CPIVolatilitySurface>(),
75 const Handle<YieldTermStructure>& yts = Handle<YieldTermStructure>(),
76 const bool useLastFixing = false);
77};
78
79class CappedFlooredCPICouponPricer : public QuantLib::CPICouponPricer {
80public:
81 CappedFlooredCPICouponPricer(const Handle<QuantLib::CPIVolatilitySurface>& vol = Handle<QuantLib::CPIVolatilitySurface>(),
82 const Handle<YieldTermStructure>& yts = Handle<YieldTermStructure>());
83
84 Handle<YieldTermStructure> yieldCurve() { return nominalTermStructure(); }
85 Handle<QuantLib::CPIVolatilitySurface> volatility() { return capletVolatility(); }
86
87 QuantLib::ext::shared_ptr<PricingEngine> engine() { return engine_; }
88
89protected:
90 // engine to price the underlying cap/floor
91 QuantLib::ext::shared_ptr<PricingEngine> engine_;
92};
93
94
96public:
97 BlackCPICouponPricer(const Handle<QuantLib::CPIVolatilitySurface>& vol = Handle<QuantLib::CPIVolatilitySurface>(),
98 const Handle<YieldTermStructure>& yts = Handle<YieldTermStructure>(),
99 const bool useLastFixing = false);
100};
101
103public:
105 const Handle<QuantLib::CPIVolatilitySurface>& vol = Handle<QuantLib::CPIVolatilitySurface>(),
106 const Handle<YieldTermStructure>& yts = Handle<YieldTermStructure>(),
107 const bool useLastFixing = false);
108};
109
110} // namespace QuantExt
111
112#endif
Bachelier CPI CashFlow Pricer.
Black CPI CashFlow Pricer.
QuantLib::ext::shared_ptr< PricingEngine > engine()
Handle< YieldTermStructure > yieldCurve()
QuantLib::ext::shared_ptr< PricingEngine > engine_
Handle< QuantLib::CPIVolatilitySurface > volatility()
Base class for CPI CashFLow and Coupon pricers.
Handle< YieldTermStructure > yts_
QuantLib::ext::shared_ptr< PricingEngine > engine()
Handle< YieldTermStructure > yieldCurve()
Handle< QuantLib::CPIVolatilitySurface > vol_
QuantLib::ext::shared_ptr< PricingEngine > engine_
Handle< QuantLib::CPIVolatilitySurface > volatility()
Inspectors.
virtual void update() override
CPI leg builder extending QuantLib's to handle caps and floors.