Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
optionletstripper2.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 qle/termstructures/optionletstripper2.hpp
20 \brief ATM optionlet (caplet/floorlet) volatility stripper
21 \ingroup termstructures
22*/
23
24#ifndef quantext_optionletstripper2_hpp
25#define quantext_optionletstripper2_hpp
26
27#include <ql/termstructures/volatility/capfloor/capfloortermvolcurve.hpp>
29
30namespace QuantExt {
31using namespace QuantLib;
32using std::vector;
33
34/*! Helper class to extend a QuantExt::OptionletStripper object stripping
35 additional optionlet (i.e. caplet/floorlet) volatilities (a.k.a.
36 forward-forward volatilities) from the (cap/floor) At-The-Money
37 term volatilities of a CapFloorTermVolCurve.
38
39 \ingroup termstructures
40*/
42public:
43 //! Optionlet stripper that modifies the stripped optionlets from \p optionletStripper by adding optionlet
44 //! volatilities stripped from an ATM volatility curve \p atmCapFloorTermVolCurve
45 OptionletStripper2(const QuantLib::ext::shared_ptr<QuantExt::OptionletStripper>& optionletStripper,
46 const Handle<QuantLib::CapFloorTermVolCurve>& atmCapFloorTermVolCurve,
47 const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>(),
48 const VolatilityType type = ShiftedLognormal, const Real displacement = 0.0);
49
50 vector<Rate> atmCapFloorStrikes() const;
51 vector<Real> atmCapFloorPrices() const;
52
53 vector<Volatility> spreadsVol() const;
54
55 //! \name LazyObject interface
56 //@{
57 void performCalculations() const override;
58 //@}
59private:
60 vector<Volatility> spreadsVolImplied(const Handle<YieldTermStructure>& discount) const;
61
63 public:
64 ObjectiveFunction(const QuantLib::ext::shared_ptr<QuantExt::OptionletStripper>&,
65 const QuantLib::ext::shared_ptr<QuantLib::CapFloor>&, Real targetValue,
66 const Handle<YieldTermStructure>& discount);
67 Real operator()(Volatility spreadVol) const;
68
69 private:
70 QuantLib::ext::shared_ptr<SimpleQuote> spreadQuote_;
71 QuantLib::ext::shared_ptr<QuantLib::CapFloor> cap_;
73 const Handle<YieldTermStructure> discount_;
74 };
75
76 const QuantLib::ext::shared_ptr<QuantExt::OptionletStripper> stripper_;
77 const Handle<QuantLib::CapFloorTermVolCurve> atmCapFloorTermVolCurve_;
78 DayCounter dc_;
80 mutable vector<Rate> atmCapFloorStrikes_;
81 mutable vector<Real> atmCapFloorPrices_;
82 mutable vector<Volatility> spreadsVolImplied_;
83 mutable vector<QuantLib::ext::shared_ptr<QuantLib::CapFloor> > caps_;
86 const VolatilityType inputVolatilityType_;
88};
89} // namespace QuantExt
90
91#endif
const Handle< YieldTermStructure > discount_
QuantLib::ext::shared_ptr< SimpleQuote > spreadQuote_
QuantLib::ext::shared_ptr< QuantLib::CapFloor > cap_
void performCalculations() const override
vector< Real > atmCapFloorPrices() const
const Handle< QuantLib::CapFloorTermVolCurve > atmCapFloorTermVolCurve_
vector< Volatility > spreadsVolImplied(const Handle< YieldTermStructure > &discount) const
const QuantLib::ext::shared_ptr< QuantExt::OptionletStripper > stripper_
vector< Rate > atmCapFloorStrikes() const
vector< Volatility > spreadsVolImplied_
vector< QuantLib::ext::shared_ptr< QuantLib::CapFloor > > caps_
const VolatilityType inputVolatilityType_
vector< Volatility > spreadsVol() const
Real displacement() const override
Optionlet (caplet/floorlet) volatility strippers.