Coverage Report

Created: 2025-09-04 07:11

/src/quantlib/ql/experimental/volatility/interestratevolsurface.hpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2007 Ferdinando Ametrano
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 interestratevolsurface.hpp
21
    \brief Interest rate volatility (smile) surface
22
*/
23
24
#ifndef quantlib_interest_rate_vol_surface_hpp
25
#define quantlib_interest_rate_vol_surface_hpp
26
27
#include <ql/experimental/volatility/blackvolsurface.hpp>
28
#include <ql/indexes/interestrateindex.hpp>
29
30
namespace QuantLib {
31
32
    //! Interest rate volatility (smile) surface
33
    /*! This abstract class defines the interface of concrete
34
        Interest rate volatility (smile) surfaces which will
35
        be derived from this one.
36
37
        Volatilities are assumed to be expressed on an annual basis.
38
    */
39
    class InterestRateVolSurface : public BlackVolSurface {
40
      public:
41
        /*! \name Constructors
42
            See the TermStructure documentation for issues regarding
43
            constructors.
44
        */
45
        //@{
46
        /*! \warning term structures initialized by means of this
47
                     constructor must manage their own reference date
48
                     by overriding the referenceDate() method.
49
        */
50
        explicit InterestRateVolSurface(ext::shared_ptr<InterestRateIndex>,
51
                                        BusinessDayConvention bdc = Following,
52
                                        const DayCounter& dc = DayCounter());
53
        //! initialize with a fixed reference date
54
        InterestRateVolSurface(ext::shared_ptr<InterestRateIndex>,
55
                               const Date& referenceDate,
56
                               const Calendar& cal = Calendar(),
57
                               BusinessDayConvention bdc = Following,
58
                               const DayCounter& dc = DayCounter());
59
        //! calculate the reference date based on the global evaluation date
60
        InterestRateVolSurface(ext::shared_ptr<InterestRateIndex>,
61
                               Natural settlementDays,
62
                               const Calendar&,
63
                               BusinessDayConvention bdc = Following,
64
                               const DayCounter& dc = DayCounter());
65
        //@}
66
        //! \name VolatilityTermStructure interface
67
        //@{
68
        //! period/date conversion
69
        Date optionDateFromTenor(const Period&) const;
70
        //@}
71
        const ext::shared_ptr<InterestRateIndex>& index() const;
72
        //! \name Visitability
73
        //@{
74
        void accept(AcyclicVisitor&) override;
75
        //@}
76
      protected:
77
        ext::shared_ptr<InterestRateIndex> index_;
78
    };
79
80
81
    // inline
82
83
    inline const ext::shared_ptr<InterestRateIndex>&
84
0
    InterestRateVolSurface::index() const {
85
0
        return index_;
86
0
    }
87
88
}
89
90
#endif