Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
inflationcapfloorengines.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 inflationcapfloorengines.hpp
20 \brief Inflation cap/floor engines from QuantLib, with optional external discount curve
21 */
22
23#pragma once
24
25#include <ql/instruments/inflationcapfloor.hpp>
26#include <ql/option.hpp>
27#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
28
29namespace QuantLib {
30class Quote;
32class YoYInflationIndex;
33} // namespace QuantLib
34
35namespace QuantExt {
36
37using namespace QuantLib;
38
39//! Base YoY inflation cap/floor engine
40/*! This class doesn't know yet what sort of vol it is. The
41 inflation index must be linked to a yoy inflation term
42 structure. This provides the curves, hence the call uses a
43 shared_ptr<> not a handle<> to the index.
44
45 \ingroup inflationcapfloorengines
46*/
48public:
49 YoYInflationCapFloorEngine(const ext::shared_ptr<QuantLib::YoYInflationIndex>&,
50 const Handle<QuantLib::YoYOptionletVolatilitySurface>& vol,
51 const Handle<YieldTermStructure>& discountCurve);
52
53 ext::shared_ptr<QuantLib::YoYInflationIndex> index() const { return index_; }
54 Handle<QuantLib::YoYOptionletVolatilitySurface> volatility() const { return volatility_; }
55
56 void setVolatility(const Handle<QuantLib::YoYOptionletVolatilitySurface>& vol);
57
58 void calculate() const override;
59
60protected:
61 //! descendents only need to implement this
62 virtual Real optionletImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real d) const = 0;
63 virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime,
64 Real d) const = 0;
65
66 ext::shared_ptr<QuantLib::YoYInflationIndex> index_;
67 Handle<QuantLib::YoYOptionletVolatilitySurface> volatility_;
68 Handle<YieldTermStructure> discountCurve_;
69};
70
71//! Black-formula inflation cap/floor engine (standalone, i.e. no coupon pricer)
73public:
74 YoYInflationBlackCapFloorEngine(const ext::shared_ptr<QuantLib::YoYInflationIndex>&,
75 const Handle<QuantLib::YoYOptionletVolatilitySurface>&,
76 const Handle<YieldTermStructure>& discountCurve);
77
78protected:
79 virtual Real optionletImpl(Option::Type, Real strike, Real forward, Real stdDev, Real d) const override;
80 virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime,
81 Real d) const override;
82};
83
84//! Unit Displaced Black-formula inflation cap/floor engine (standalone, i.e. no coupon pricer)
86public:
87 YoYInflationUnitDisplacedBlackCapFloorEngine(const ext::shared_ptr<QuantLib::YoYInflationIndex>&,
88 const Handle<QuantLib::YoYOptionletVolatilitySurface>&,
89 const Handle<YieldTermStructure>& discountCurve);
90
91protected:
92 virtual Real optionletImpl(Option::Type, Real strike, Real forward, Real stdDev, Real d) const override;
93 virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime,
94 Real d) const override;
95};
96
97//! Unit Displaced Black-formula inflation cap/floor engine (standalone, i.e. no coupon pricer)
99public:
100 YoYInflationBachelierCapFloorEngine(const ext::shared_ptr<QuantLib::YoYInflationIndex>&,
101 const Handle<QuantLib::YoYOptionletVolatilitySurface>&,
102 const Handle<YieldTermStructure>& discountCurve);
103
104protected:
105 virtual Real optionletImpl(Option::Type, Real strike, Real forward, Real stdDev, Real d) const override;
106 virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime,
107 Real d) const override;
108};
109
110} // namespace QuantExt
Unit Displaced Black-formula inflation cap/floor engine (standalone, i.e. no coupon pricer)
virtual Real optionletImpl(Option::Type, Real strike, Real forward, Real stdDev, Real d) const override
virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime, Real d) const override
Black-formula inflation cap/floor engine (standalone, i.e. no coupon pricer)
virtual Real optionletImpl(Option::Type, Real strike, Real forward, Real stdDev, Real d) const override
virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime, Real d) const override
Base YoY inflation cap/floor engine.
virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime, Real d) const =0
virtual Real optionletImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real d) const =0
descendents only need to implement this
void setVolatility(const Handle< QuantLib::YoYOptionletVolatilitySurface > &vol)
Handle< QuantLib::YoYOptionletVolatilitySurface > volatility() const
ext::shared_ptr< QuantLib::YoYInflationIndex > index() const
ext::shared_ptr< QuantLib::YoYInflationIndex > index_
Handle< QuantLib::YoYOptionletVolatilitySurface > volatility_
Unit Displaced Black-formula inflation cap/floor engine (standalone, i.e. no coupon pricer)
virtual Real optionletImpl(Option::Type, Real strike, Real forward, Real stdDev, Real d) const override
virtual Real optionletVegaImpl(Option::Type type, Rate strike, Rate forward, Real stdDev, Real sqrtTime, Real d) const override