QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
optionletstripper2.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Giorgio Facchinetti
5 Copyright (C) 2010 Ferdinando Ametrano
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file optionletstripper2.hpp
22 \brief optionlet (caplet/floorlet) volatility stripper
23*/
24
25#ifndef quantlib_optionletstripper2_hpp
26#define quantlib_optionletstripper2_hpp
27
29
30namespace QuantLib {
31
32 class CapFloorTermVolCurve;
33 class OptionletStripper1;
34 class SimpleQuote;
35 class CapFloor;
36
37 /*! Helper class to extend an OptionletStripper1 object stripping
38 additional optionlet (i.e. caplet/floorlet) volatilities (a.k.a.
39 forward-forward volatilities) from the (cap/floor) At-The-Money
40 term volatilities of a CapFloorTermVolCurve.
41 */
43 public:
44 // Handle or just shared_ptr ??
46 const ext::shared_ptr<OptionletStripper1>& optionletStripper1,
47 const Handle<CapFloorTermVolCurve>& atmCapFloorTermVolCurve);
48
49 std::vector<Rate> atmCapFloorStrikes() const;
50 std::vector<Real> atmCapFloorPrices() const;
51
52 std::vector<Volatility> spreadsVol() const;
53
54 //! \name LazyObject interface
55 //@{
56 void performCalculations() const override;
57 //@}
58 private:
59 std::vector<Volatility> spreadsVolImplied() const;
60
62 public:
63 ObjectiveFunction(const ext::shared_ptr<OptionletStripper1>&,
64 ext::shared_ptr<CapFloor>,
65 Real targetValue);
66 Real operator()(Volatility spreadVol) const;
67 private:
68 ext::shared_ptr<SimpleQuote> spreadQuote_;
69 ext::shared_ptr<CapFloor> cap_;
71 };
72
73 const ext::shared_ptr<OptionletStripper1> stripper1_;
77 mutable std::vector<Rate> atmCapFloorStrikes_;
78 mutable std::vector<Real> atmCapFloorPrices_;
79 mutable std::vector<Volatility> spreadsVolImplied_;
80 mutable std::vector<ext::shared_ptr<CapFloor> > caps_;
82 Real accuracy_ = 1.e-6;
83 };
84
85}
86
87#endif
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
void performCalculations() const override
std::vector< Volatility > spreadsVolImplied_
const ext::shared_ptr< OptionletStripper1 > stripper1_
std::vector< Rate > atmCapFloorStrikes_
std::vector< Real > atmCapFloorPrices_
std::vector< ext::shared_ptr< CapFloor > > caps_
std::vector< Volatility > spreadsVolImplied() const
std::vector< Rate > atmCapFloorStrikes() const
std::vector< Volatility > spreadsVol() const
const Handle< CapFloorTermVolCurve > atmCapFloorTermVolCurve_
std::vector< Real > atmCapFloorPrices() const
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
optionlet (caplet/floorlet) volatility stripper