• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lballabio / QuantLib / 27081312717

07 Jun 2026 03:17AM UTC coverage: 74.801% (+0.004%) from 74.797%
27081312717

Pull #2619

github

web-flow
Merge d8f820f5b into 5111c3a14
Pull Request #2619: Use make_shared in volatility-related code

54 of 72 new or added lines in 22 files covered. (75.0%)

1 existing line in 1 file now uncovered.

59143 of 79067 relevant lines covered (74.8%)

8576610.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.22
/ql/termstructures/volatility/swaption/spreadedswaptionvol.cpp
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2

3
/*
4
 Copyright (C) 2008 Ferdinando Ametrano
5
 Copyright (C) 2007 Giorgio Facchinetti
6

7
 This file is part of QuantLib, a free-software/open-source library
8
 for financial quantitative analysts and developers - http://quantlib.org/
9

10
 QuantLib is free software: you can redistribute it and/or modify it
11
 under the terms of the QuantLib license.  You should have received a
12
 copy of the license along with this program; if not, please email
13
 <quantlib-dev@lists.sf.net>. The license is also available online at
14
 <https://www.quantlib.org/license.shtml>.
15

16
 This program is distributed in the hope that it will be useful, but WITHOUT
17
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
 FOR A PARTICULAR PURPOSE.  See the license for more details.
19
*/
20

21
#include <ql/quote.hpp>
22
#include <ql/termstructures/volatility/spreadedsmilesection.hpp>
23
#include <ql/termstructures/volatility/swaption/spreadedswaptionvol.hpp>
24
#include <utility>
25

26
namespace QuantLib {
27

28
    SpreadedSwaptionVolatility::SpreadedSwaptionVolatility(
1✔
29
        const Handle<SwaptionVolatilityStructure>& baseVol, Handle<Quote> spread)
1✔
30
    : SwaptionVolatilityStructure(baseVol->businessDayConvention(), baseVol->dayCounter()),
1✔
31
      baseVol_(baseVol), spread_(std::move(spread)) {
3✔
32
        enableExtrapolation(baseVol->allowsExtrapolation());
1✔
33
        registerWith(baseVol_);
2✔
34
        registerWith(spread_);
1✔
35
    }
1✔
36

37
    ext::shared_ptr<SmileSection>
38
    SpreadedSwaptionVolatility::smileSectionImpl(const Date& d,
9✔
39
                                                 const Period& swapT) const {
40
        ext::shared_ptr<SmileSection> baseSmile =
41
            baseVol_->smileSection(d, swapT, true);
9✔
42
        return ext::make_shared<SpreadedSmileSection>(baseSmile, spread_);
18✔
43
    }
44

45
    ext::shared_ptr<SmileSection>
46
    SpreadedSwaptionVolatility::smileSectionImpl(Time optionTime,
×
47
                                                 Time swapLength) const {
48
        ext::shared_ptr<SmileSection> baseSmile =
49
            baseVol_->smileSection(optionTime, swapLength, true);
×
NEW
50
        return ext::make_shared<SpreadedSmileSection>(baseSmile, spread_);
×
51
    }
52

53
    Volatility SpreadedSwaptionVolatility::volatilityImpl(const Date& d,
891✔
54
                                                          const Period& p,
55
                                                          Rate strike) const {
56
        return baseVol_->volatility(d, p, strike, true) + spread_->value();
891✔
57
    }
58

59
    Volatility SpreadedSwaptionVolatility::volatilityImpl(Time t,
×
60
                                                          Time l,
61
                                                          Rate strike) const {
62
        return baseVol_->volatility(t, l, strike, true) + spread_->value();
×
63
    }
64

65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc