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

lballabio / QuantLib / 23483602312

24 Mar 2026 09:59AM UTC coverage: 74.379% (+0.003%) from 74.376%
23483602312

push

github

web-flow
Deprecate `ForwardRateStructure` in favor of `ZeroYieldStructure` (#2261)

5 of 9 new or added lines in 2 files covered. (55.56%)

3 existing lines in 1 file now uncovered.

58142 of 78170 relevant lines covered (74.38%)

8768858.76 hits per line

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

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

3
/*
4
 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
5
 Copyright (C) 2003, 2004 StatPro Italia srl
6
 Copyright (C) 2009 Ferdinando Ametrano
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
#include <ql/termstructures/yield/forwardstructure.hpp>
23

24
namespace QuantLib {
25

UNCOV
26
    ForwardRateStructure::ForwardRateStructure(const DayCounter& dc)
×
NEW
27
    : ZeroYieldStructure(dc) {}
×
28

UNCOV
29
    ForwardRateStructure::ForwardRateStructure(
×
30
                                    const Date& refDate,
31
                                    const Calendar& cal,
32
                                    const DayCounter& dc,
33
                                    const std::vector<Handle<Quote> >& jumps,
34
                                    const std::vector<Date>& jumpDates)
×
NEW
35
    : ZeroYieldStructure(refDate, cal, dc, jumps, jumpDates) {}
×
36

UNCOV
37
    ForwardRateStructure::ForwardRateStructure(
×
38
                                    Natural settlDays,
39
                                    const Calendar& cal,
40
                                    const DayCounter& dc,
41
                                    const std::vector<Handle<Quote> >& jumps,
42
                                    const std::vector<Date>& jumpDates)
×
NEW
43
    : ZeroYieldStructure(settlDays, cal, dc, jumps, jumpDates) {}
×
44

45
    Rate ForwardRateStructure::zeroYieldImpl(Time t) const {
×
46
        if (t == 0.0)
×
47
            return forwardImpl(0.0);
×
48
        // implement smarter integration if plan to use the following code
49
        Rate sum = 0.5*forwardImpl(0.0);
×
50
        Size N = 1000;
51
        Time dt = t/N;
×
52
        for (Time i=dt; i<t; i+=dt)
×
53
            sum += forwardImpl(i);
×
54
        sum += 0.5*forwardImpl(t);
×
55
        return Rate(sum*dt/t);
×
56
    }
57

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