• 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

60.0
/ql/termstructures/volatility/optionlet/spreadedoptionletvol.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/optionlet/spreadedoptionletvol.hpp>
23
#include <ql/termstructures/volatility/spreadedsmilesection.hpp>
24
#include <utility>
25

26
namespace QuantLib {
27

28
    SpreadedOptionletVolatility::SpreadedOptionletVolatility(
26✔
29
        const Handle<OptionletVolatilityStructure>& baseVol, Handle<Quote> spread)
26✔
30
    : baseVol_(baseVol), spread_(std::move(spread)) {
52✔
31
        enableExtrapolation(baseVol->allowsExtrapolation());
26✔
32
        registerWith(baseVol_);
52✔
33
        registerWith(spread_);
26✔
34
    }
26✔
35

36
    ext::shared_ptr<SmileSection>
37
    SpreadedOptionletVolatility::smileSectionImpl(const Date& d) const {
×
38
        ext::shared_ptr<SmileSection> baseSmile =
39
            baseVol_->smileSection(d, true);
×
NEW
40
        return ext::make_shared<SpreadedSmileSection>(baseSmile, spread_);
×
41
    }
42

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

50
    Volatility SpreadedOptionletVolatility::volatilityImpl(Time t,
2,648✔
51
                                                           Rate s) const {
52
        return baseVol_->volatility(t, s, true) + spread_->value();
2,648✔
53
    }
54

55
}
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