Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
optionletstripper1.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/optionletstripper1.hpp
20 \brief Optionlet (caplet/floorlet) volatility strippers
21 \ingroup termstructures
22*/
23
24#ifndef quantext_optionletstripper1_hpp
25#define quantext_optionletstripper1_hpp
26
27#include <ql/instruments/capfloor.hpp>
28#include <ql/quotes/simplequote.hpp>
30
31#include <boost/optional.hpp>
32
33namespace QuantExt {
34using namespace QuantLib;
35using boost::optional;
36
37typedef std::vector<std::vector<QuantLib::ext::shared_ptr<QuantLib::CapFloor> > > CapFloorMatrix;
38
39/*! Helper class to strip optionlet (i.e. caplet/floorlet) volatilities
40 (a.k.a. forward-forward volatilities) from the (cap/floor) term
41 volatilities of a CapFloorTermVolSurface.
42 \ingroup termstructures
43*/
45public:
46 // If dontThrow is set to true than any vols that would throw are set to dontThrowMinVol (default is 0.0)
47 OptionletStripper1(const QuantLib::ext::shared_ptr<QuantExt::CapFloorTermVolSurface>&,
48 const QuantLib::ext::shared_ptr<IborIndex>& index, Rate switchStrikes = Null<Rate>(),
49 Real accuracy = 1.0e-6, Natural maxIter = 100,
50 const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>(),
51 const VolatilityType type = ShiftedLognormal, const Real displacement = 0.0,
52 const optional<VolatilityType> targetVolatilityType = boost::none,
53 const optional<Real> targetDisplacement = boost::none);
54
55 const Matrix& capFloorPrices() const;
56 const Matrix& capletVols() const;
57 const Matrix& capFloorVolatilities() const;
58 const Matrix& optionletPrices() const;
59 Rate switchStrike() const;
60 const Handle<YieldTermStructure>& discountCurve() const { return discount_; }
61
62 //! \name LazyObject interface
63 //@{
64 void performCalculations() const override;
65 //@}
66private:
67 bool stripOptionlets(std::vector<Real>&, CapFloor::Type, Size, const Handle<YieldTermStructure>&, Real) const;
68
70 mutable Matrix capFloorVols_;
72
74 mutable std::vector<std::vector<QuantLib::ext::shared_ptr<SimpleQuote> > > volQuotes_;
75 mutable std::vector<std::vector<QuantLib::ext::shared_ptr<PricingEngine> > > capFloorEngines_;
78 mutable Rate switchStrike_;
80 Natural maxIter_;
81 const VolatilityType inputVolatilityType_;
83};
84} // namespace QuantExt
85
86#endif
const Matrix & capletVols() const
void performCalculations() const override
std::vector< std::vector< QuantLib::ext::shared_ptr< SimpleQuote > > > volQuotes_
std::vector< std::vector< QuantLib::ext::shared_ptr< PricingEngine > > > capFloorEngines_
const Matrix & optionletPrices() const
bool stripOptionlets(std::vector< Real > &, CapFloor::Type, Size, const Handle< YieldTermStructure > &, Real) const
const Matrix & capFloorPrices() const
const Handle< YieldTermStructure > & discountCurve() const
const VolatilityType inputVolatilityType_
const Matrix & capFloorVolatilities() const
Handle< YieldTermStructure > discount_
Real displacement() const override
ext::shared_ptr< IborIndex > index() const
std::vector< std::vector< QuantLib::ext::shared_ptr< QuantLib::CapFloor > > > CapFloorMatrix
optionlet (caplet/floorlet) volatility stripper