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

lballabio / QuantLib / 19783858710

29 Nov 2025 12:27PM UTC coverage: 74.349% (+0.4%) from 73.914%
19783858710

Pull #2344

github

web-flow
Merge 04019bd61 into 08ef06893
Pull Request #2344: add multicurve bootstrap

107 of 120 new or added lines in 6 files covered. (89.17%)

413 existing lines in 27 files now uncovered.

57214 of 76953 relevant lines covered (74.35%)

8802593.09 hits per line

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

88.89
/ql/termstructures/multicurve.cpp
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2

3
/*
4
 Copyright (C) 2025 Eugene Toder
5
 Copyright (C) 2025 Peter Caspers
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
 <http://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/termstructures/multicurve.hpp>
22

23
namespace QuantLib {
24

25
    MultiCurve::MultiCurve(Real accuracy)
2✔
26
    : multiCurveBootstrap_(ext::make_shared<MultiCurveBootstrap>(accuracy)) {}
2✔
27

NEW
28
    MultiCurve::MultiCurve(ext::shared_ptr<OptimizationMethod> optimizer,
×
NEW
29
                           ext::shared_ptr<EndCriteria> endCriteria)
×
NEW
30
    : multiCurveBootstrap_(ext::make_shared<MultiCurveBootstrap>(optimizer, endCriteria)) {}
×
31

32
    Handle<YieldTermStructure>
33
    MultiCurve::addCurve(ext::shared_ptr<MultiCurve> multiCurve,
3✔
34
                         RelinkableHandle<YieldTermStructure>& internalHandle,
35
                         ext::shared_ptr<YieldTermStructure> curve,
36
                         MultiCurveBootstrapContributor* bootstrap) {
37

38
        QL_REQUIRE(internalHandle.empty(),
3✔
39
                   "internal handle must be empty; was the curve added already?");
40
        QL_REQUIRE(curve != nullptr, "curve must not be null");
3✔
41

42
        multiCurveBootstrap_->add(bootstrap);
3✔
43

44
        internalHandle.linkTo(ext::shared_ptr<YieldTermStructure>(curve.get(), null_deleter()),
6✔
45
                              false);
46
        Handle<YieldTermStructure> externalHandle(
47
            ext::shared_ptr<YieldTermStructure>(multiCurve, curve.get()));
3✔
48
        registerWithObservables(curve);
3✔
49
        curves_.push_back(std::move(curve));
3✔
50

51
        return externalHandle;
3✔
52
    }
53

54
    Handle<YieldTermStructure>
55
    MultiCurve::addNonPiecewiseCurve(ext::shared_ptr<MultiCurve> multiCurve,
1✔
56
                         RelinkableHandle<YieldTermStructure>& internalHandle,
57
                         ext::shared_ptr<YieldTermStructure> curve) {
58
        QL_REQUIRE(internalHandle.empty(),
1✔
59
                   "internal handle must be empty; was the curve added already?");
60
        QL_REQUIRE(curve != nullptr, "curve must not be null");
1✔
61

62
        multiCurveBootstrap_->addObserver(curve.get());
1✔
63

64
        internalHandle.linkTo(ext::shared_ptr<YieldTermStructure>(curve.get(), null_deleter()),
2✔
65
                              false);
66
        Handle<YieldTermStructure> externalHandle(
67
            ext::shared_ptr<YieldTermStructure>(multiCurve, curve.get()));
1✔
68
        registerWithObservables(curve);
1✔
69
        curves_.push_back(std::move(curve));
1✔
70

71
        return externalHandle;
1✔
72
    }
73

74
    void MultiCurve::update() {
2✔
75
        for (auto const& c : curves_)
4✔
76
            c->update();
2✔
77
    }
2✔
78

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

© 2026 Coveralls, Inc