Coverage Report

Created: 2026-10-31 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/pricingengines/capfloor/blackcapfloorengine.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2007 Ferdinando Ametrano
5
 Copyright (C) 2001, 2002, 2003 Sadruddin Rejeb
6
 Copyright (C) 2006 StatPro Italia srl
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 blackcapfloorengine.hpp
23
    \brief Black-formula cap/floor engine
24
*/
25
26
#ifndef quantlib_pricers_black_capfloor_hpp
27
#define quantlib_pricers_black_capfloor_hpp
28
29
#include <ql/instruments/capfloor.hpp>
30
#include <ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp>
31
32
namespace QuantLib {
33
34
    class Quote;
35
36
    //! Black-formula cap/floor engine
37
    /*! \ingroup capfloorengines */
38
    class BlackCapFloorEngine : public CapFloor::engine {
39
      public:
40
        BlackCapFloorEngine(Handle<YieldTermStructure> discountCurve,
41
                            Volatility vol,
42
                            const DayCounter& dc = Actual365Fixed(),
43
                            Real displacement = 0.0);
44
        BlackCapFloorEngine(Handle<YieldTermStructure> discountCurve,
45
                            const Handle<Quote>& vol,
46
                            const DayCounter& dc = Actual365Fixed(),
47
                            Real displacement = 0.0);
48
        BlackCapFloorEngine(Handle<YieldTermStructure> discountCurve,
49
                            Handle<OptionletVolatilityStructure> vol,
50
                            Real displacement = Null<Real>());
51
        void calculate() const override;
52
0
        Handle<YieldTermStructure> termStructure() { return discountCurve_; }
53
0
        Handle<OptionletVolatilityStructure> volatility() { return vol_; }
54
0
        Real displacement() const { return displacement_; }
55
56
      private:
57
        Handle<YieldTermStructure> discountCurve_;
58
        Handle<OptionletVolatilityStructure> vol_;
59
        Real displacement_;
60
    };
61
62
}
63
64
#endif