Coverage Report

Created: 2026-10-31 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/termstructures/volatility/atmsmilesection.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2013 Peter Caspers
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 atmsmilesection.hpp
21
    \brief smile section that allows for explicit / alternate specification of
22
   atm level
23
*/
24
25
#ifndef quantlib_atm_smile_section_hpp
26
#define quantlib_atm_smile_section_hpp
27
28
#include <ql/termstructures/volatility/smilesection.hpp>
29
30
namespace QuantLib {
31
32
    class AtmSmileSection : public SmileSection {
33
34
      public:
35
        AtmSmileSection(const ext::shared_ptr<SmileSection>& source, Real atm = Null<Real>());
36
37
0
        Real minStrike() const override { return source_->minStrike(); }
38
0
        Real maxStrike() const override { return source_->maxStrike(); }
39
0
        Real atmLevel() const override { return f_; }
40
0
        const Date& exerciseDate() const override { return source_->exerciseDate(); }
41
0
        Time exerciseTime() const override { return source_->exerciseTime(); }
42
0
        const DayCounter& dayCounter() const override { return source_->dayCounter(); }
43
0
        const Date& referenceDate() const override { return source_->referenceDate(); }
44
0
        VolatilityType volatilityType() const override { return source_->volatilityType(); }
45
0
        Rate shift() const override { return source_->shift(); }
46
47
      protected:
48
0
        Volatility volatilityImpl(Rate strike) const override {
49
0
            return source_->volatility(strike);
50
0
        }
51
0
        Real varianceImpl(Rate strike) const override { return source_->variance(strike); }
52
53
      private:
54
        ext::shared_ptr<SmileSection> source_;
55
        Real f_;
56
    };
57
}
58
59
#endif