Coverage Report

Created: 2026-03-11 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/termstructures/volatility/spreadedsmilesection.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2006 Mario Pucci
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <https://www.quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
/*! \file spreadedsmilesection.hpp
21
    \brief Spreaded SmileSection class
22
*/
23
24
#ifndef quantlib_spreaded_smile_section_hpp
25
#define quantlib_spreaded_smile_section_hpp
26
27
#include <ql/termstructures/volatility/smilesection.hpp>
28
#include <ql/handle.hpp>
29
30
namespace QuantLib {
31
32
    class Quote;
33
34
    class SpreadedSmileSection : public SmileSection {
35
      public:
36
        SpreadedSmileSection(ext::shared_ptr<SmileSection>, Handle<Quote> spread);
37
        //! \name SmileSection interface
38
        //@{
39
        Real minStrike() const override;
40
        Real maxStrike() const override;
41
        Real atmLevel() const override;
42
        const Date& exerciseDate() const override;
43
        Time exerciseTime() const override;
44
        const DayCounter& dayCounter() const override;
45
        const Date& referenceDate() const override;
46
        VolatilityType volatilityType() const override;
47
        Rate shift() const override;
48
        //@}
49
        //! \name LazyObject interface
50
        //@{
51
0
        void update() override { notifyObservers(); }
52
        //@}
53
      protected:
54
        Volatility volatilityImpl(Rate strike) const override;
55
56
      private:
57
        const ext::shared_ptr<SmileSection> underlyingSection_;
58
        const Handle<Quote> spread_;
59
    };
60
61
0
    inline Real SpreadedSmileSection::minStrike() const {
62
0
        return underlyingSection_->minStrike();
63
0
    }
64
65
0
    inline Real SpreadedSmileSection::maxStrike() const {
66
0
        return underlyingSection_->maxStrike();
67
0
    }
68
69
0
    inline Real SpreadedSmileSection::atmLevel() const {
70
0
        return underlyingSection_->atmLevel();
71
0
    }
72
73
0
    inline const Date& SpreadedSmileSection::exerciseDate() const {
74
0
        return underlyingSection_->exerciseDate();
75
0
    }
76
77
0
    inline Time SpreadedSmileSection::exerciseTime() const {
78
0
        return underlyingSection_->exerciseTime();
79
0
    }
80
81
0
    inline const DayCounter& SpreadedSmileSection::dayCounter() const {
82
0
        return underlyingSection_->dayCounter();
83
0
    }
84
85
0
    inline const Date& SpreadedSmileSection::referenceDate() const {
86
0
        return underlyingSection_->referenceDate();
87
0
    }
88
89
0
    inline VolatilityType SpreadedSmileSection::volatilityType() const {
90
0
        return underlyingSection_->volatilityType();
91
0
    }
92
93
0
    inline Rate SpreadedSmileSection::shift() const {
94
0
        return underlyingSection_->shift();
95
0
    }
96
}
97
98
#endif