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, 2005, 2007 StatPro Italia srl
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/quotes/simplequote.hpp>
22#include <ql/termstructures/yield/flatforward.hpp>
23#include <utility>
24
25namespace QuantLib {
26
27 FlatForward::FlatForward(const Date& referenceDate,
28 Handle<Quote> forward,
29 const DayCounter& dayCounter,
30 Compounding compounding,
31 Frequency frequency)
32 : YieldTermStructure(referenceDate, Calendar(), dayCounter), forward_(std::move(forward)),
33 compounding_(compounding), frequency_(frequency) {
34 registerWith(h: forward_);
35 }
36
37 FlatForward::FlatForward(const Date& referenceDate,
38 Rate forward,
39 const DayCounter& dayCounter,
40 Compounding compounding,
41 Frequency frequency)
42 : YieldTermStructure(referenceDate, Calendar(), dayCounter),
43 forward_(ext::shared_ptr<Quote>(new SimpleQuote(forward))),
44 compounding_(compounding), frequency_(frequency) {}
45
46 FlatForward::FlatForward(Natural settlementDays,
47 const Calendar& calendar,
48 Handle<Quote> forward,
49 const DayCounter& dayCounter,
50 Compounding compounding,
51 Frequency frequency)
52 : YieldTermStructure(settlementDays, calendar, dayCounter), forward_(std::move(forward)),
53 compounding_(compounding), frequency_(frequency) {
54 registerWith(h: forward_);
55 }
56
57 FlatForward::FlatForward(Natural settlementDays,
58 const Calendar& calendar,
59 Rate forward,
60 const DayCounter& dayCounter,
61 Compounding compounding,
62 Frequency frequency)
63 : YieldTermStructure(settlementDays, calendar, dayCounter),
64 forward_(ext::shared_ptr<Quote>(new SimpleQuote(forward))),
65 compounding_(compounding), frequency_(frequency) {}
66
67}
68

source code of quantlib/ql/termstructures/yield/flatforward.cpp