Coverage Report

Created: 2025-10-14 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/termstructures/volatility/optionlet/spreadedoptionletvol.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2008 Ferdinando Ametrano
5
 Copyright (C) 2007 Giorgio Facchinetti
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
 <https://www.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 spreadedoptionletvol.hpp
23
    \brief Spreaded caplet/floorlet volatility
24
*/
25
26
#ifndef quantlib_spreaded_caplet_volstructure_h
27
#define quantlib_spreaded_caplet_volstructure_h
28
29
#include <ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp>
30
#include <ql/termstructures/volatility/optionlet/optionletstripper.hpp>
31
#include <ql/termstructures/volatility/optionlet/strippedoptionletadapter.hpp>
32
33
namespace QuantLib {
34
35
    class Quote;
36
37
    class SpreadedOptionletVolatility : public OptionletVolatilityStructure {
38
      public:
39
        SpreadedOptionletVolatility(const Handle<OptionletVolatilityStructure>&,
40
                                    Handle<Quote> spread);
41
        // All virtual methods of base classes must be forwarded
42
        //! \name VolatilityTermStructure interface
43
        //@{
44
        BusinessDayConvention businessDayConvention() const override;
45
        Rate minStrike() const override;
46
        Rate maxStrike() const override;
47
        //@}
48
        //! \name TermStructure interface
49
        //@{
50
        DayCounter dayCounter() const override;
51
        Date maxDate() const override;
52
        Time maxTime() const override;
53
        const Date& referenceDate() const override;
54
        Calendar calendar() const override;
55
        Natural settlementDays() const override;
56
        //@}
57
        VolatilityType volatilityType() const override;
58
        Real displacement() const override;
59
60
      protected:
61
        // All virtual methods of base classes must be forwarded
62
        //! \name OptionletVolatilityStructure interface
63
        //@{
64
        ext::shared_ptr<SmileSection> smileSectionImpl(const Date& d) const override;
65
        ext::shared_ptr<SmileSection> smileSectionImpl(Time optionT) const override;
66
        Volatility volatilityImpl(Time optionTime, Rate strike) const override;
67
        //@}
68
      private:
69
        const Handle<OptionletVolatilityStructure> baseVol_;
70
        const Handle<Quote> spread_;
71
    };
72
73
0
    inline DayCounter SpreadedOptionletVolatility::dayCounter() const {
74
0
        return baseVol_->dayCounter();
75
0
    }
76
    
77
0
    inline Date SpreadedOptionletVolatility::maxDate() const {
78
0
        return baseVol_->maxDate();
79
0
    }
80
81
0
    inline Time SpreadedOptionletVolatility::maxTime() const {
82
0
        return baseVol_->maxTime();
83
0
    }
84
        
85
0
    inline const Date& SpreadedOptionletVolatility::referenceDate() const {
86
0
        return baseVol_->referenceDate();
87
0
    }
88
        
89
0
    inline Calendar SpreadedOptionletVolatility::calendar() const {
90
0
        return baseVol_->calendar();
91
0
    }
92
        
93
0
    inline Natural SpreadedOptionletVolatility::settlementDays() const {
94
0
        return baseVol_->settlementDays();
95
0
    }
96
97
    inline BusinessDayConvention
98
0
    SpreadedOptionletVolatility::businessDayConvention() const {
99
0
        return baseVol_->businessDayConvention();
100
0
    }
101
    
102
0
    inline Rate SpreadedOptionletVolatility::minStrike() const {
103
0
        return baseVol_->minStrike();
104
0
    }
105
    
106
0
    inline Rate SpreadedOptionletVolatility::maxStrike() const {
107
0
        return baseVol_->maxStrike();
108
0
    }
109
110
    inline VolatilityType
111
0
    SpreadedOptionletVolatility::volatilityType() const {
112
0
        return baseVol_->volatilityType();
113
0
    }
114
115
0
    inline Real SpreadedOptionletVolatility::displacement() const {
116
0
        return baseVol_->displacement();
117
0
    }
118
}
119
120
#endif