QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
strippedoptionletadapter.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) 2007 Katiuscia Manzoni
6 Copyright (C) 2015 Peter Caspers
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22/*! \file strippedoptionletadapter.hpp
23 \brief StrippedOptionlet Adapter
24*/
25
26#ifndef quantlib_stripped_optionlet_adapter_h
27#define quantlib_stripped_optionlet_adapter_h
28
34
35namespace QuantLib {
36
37 /*! Adapter class for turning a StrippedOptionletBase object into an
38 OptionletVolatilityStructure.
39 */
41 public LazyObject {
42 public:
44 const ext::shared_ptr<StrippedOptionletBase>&);
45
46 //! \name TermStructure interface
47 //@{
48 Date maxDate() const override;
49 //@}
50 //! \name VolatilityTermStructure interface
51 //@{
52 Rate minStrike() const override;
53 Rate maxStrike() const override;
54 //@}
55 //! \name LazyObject interface
56 //@{
57 void update() override;
58 void performCalculations() const override;
59 ext::shared_ptr<OptionletStripper> optionletStripper() const;
60 //@}
61 //! \name Observer interface
62 //@{
63 void deepUpdate() override;
64 //@}
65
66 VolatilityType volatilityType() const override;
67 Real displacement() const override;
68
69 protected:
70 //! \name OptionletVolatilityStructure interface
71 //@{
72 ext::shared_ptr<SmileSection> smileSectionImpl(Time optionTime) const override;
73 Volatility volatilityImpl(Time length, Rate strike) const override;
74 //@}
75 private:
76 const ext::shared_ptr<StrippedOptionletBase> optionletStripper_;
78 mutable std::vector<ext::shared_ptr<Interpolation> > strikeInterpolations_;
79 };
80
84 }
85
87 optionletStripper_->update();
88 update();
89 }
90
91 inline ext::shared_ptr< OptionletStripper >
93 return ext::dynamic_pointer_cast< OptionletStripper >(
95 }
96}
97
98#endif
Concrete date class.
Definition: date.hpp:125
Framework for calculation on demand and result caching.
Definition: lazyobject.hpp:35
void update() override
Definition: lazyobject.hpp:188
Optionlet (caplet/floorlet) volatility structure.
const ext::shared_ptr< StrippedOptionletBase > optionletStripper_
ext::shared_ptr< OptionletStripper > optionletStripper() const
Rate maxStrike() const override
the maximum strike for which the term structure can return vols
Rate minStrike() const override
the minimum strike for which the term structure can return vols
ext::shared_ptr< SmileSection > smileSectionImpl(Time optionTime) const override
implements the actual smile calculation in derived classes
VolatilityType volatilityType() const override
Volatility volatilityImpl(Time length, Rate strike) const override
implements the actual volatility calculation in derived classes
Date maxDate() const override
the latest date for which the curve can return values
std::vector< ext::shared_ptr< Interpolation > > strikeInterpolations_
void update() override
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
base class for 1-D interpolations
Definition: any.hpp:35
optionlet (caplet/floorlet) volatility stripper
optionlet (caplet/floorlet) volatility structure
SABR interpolation interpolation between discrete points.