Coverage Report

Created: 2026-06-08 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/instruments/floatfloatswaption.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2013, 2018 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 floatfloatswaption.hpp
21
    \brief floatfloatswaption class
22
*/
23
24
#ifndef quantlib_instruments_floatfloatswaption_hpp
25
#define quantlib_instruments_floatfloatswaption_hpp
26
27
#include <ql/instruments/swaption.hpp>
28
#include <ql/instruments/floatfloatswap.hpp>
29
#include <ql/pricingengines/swaption/basketgeneratingengine.hpp>
30
#include <ql/termstructures/yieldtermstructure.hpp>
31
#include <ql/termstructures/volatility/swaption/swaptionvolstructure.hpp>
32
#include <ql/models/calibrationhelper.hpp>
33
34
namespace QuantLib {
35
36
    //! floatfloat swaption class
37
    /*! \ingroup instruments
38
    */
39
40
    class FloatFloatSwaption : public Option {
41
      public:
42
        class arguments;
43
        class engine;
44
        FloatFloatSwaption(ext::shared_ptr<FloatFloatSwap> swap,
45
                           const ext::shared_ptr<Exercise>& exercise,
46
                           Settlement::Type delivery = Settlement::Physical,
47
                           Settlement::Method settlementMethod = Settlement::PhysicalOTC);
48
        //! \name Instrument interface
49
        //@{
50
        bool isExpired() const override;
51
        void setupArguments(PricingEngine::arguments*) const override;
52
        //@}
53
        //! \name Inspectors
54
        //@{
55
0
        Settlement::Type settlementType() const { return settlementType_; }
56
0
        Settlement::Method settlementMethod() const {
57
0
            return settlementMethod_;
58
0
        }
59
0
        Swap::Type type() const { return swap_->type(); }
60
0
        const ext::shared_ptr<FloatFloatSwap> &underlyingSwap() const {
61
0
            return swap_;
62
0
        }
63
        //@}
64
        std::vector<ext::shared_ptr<BlackCalibrationHelper>>
65
        calibrationBasket(const ext::shared_ptr<SwapIndex>& standardSwapBase,
66
                          const ext::shared_ptr<SwaptionVolatilityStructure>& swaptionVolatility,
67
                          BasketGeneratingEngine::CalibrationBasketType basketType =
68
                              BasketGeneratingEngine::MaturityStrikeByDeltaGamma) const;
69
70
      private:
71
        // arguments
72
        ext::shared_ptr<FloatFloatSwap> swap_;
73
        Settlement::Type settlementType_;
74
        Settlement::Method settlementMethod_;
75
    };
76
77
    //! %Arguments for cms swaption calculation
78
    class FloatFloatSwaption::arguments : public FloatFloatSwap::arguments,
79
                                          public Option::arguments {
80
      public:
81
        arguments() = default;
82
        ext::shared_ptr<FloatFloatSwap> swap;
83
        Settlement::Type settlementType;
84
        Settlement::Method settlementMethod;
85
        void validate() const override;
86
    };
87
88
    //! base class for cms swaption engines
89
    class FloatFloatSwaption::engine
90
        : public GenericEngine<FloatFloatSwaption::arguments,
91
                               FloatFloatSwaption::results> {};
92
}
93
94
#endif