QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdmaffinemodeltermstructure.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2011 Klaus Spanderen
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
23#include <ql/methods/finitedifferences/utilities/fdmaffinemodeltermstructure.hpp>
24#include <ql/models/model.hpp>
25#include <utility>
26
27namespace QuantLib {
28
30 const Calendar& cal,
31 const DayCounter& dayCounter,
32 const Date& referenceDate,
33 const Date& modelReferenceDate,
34 ext::shared_ptr<AffineModel> model)
35 : YieldTermStructure(referenceDate, cal, dayCounter), r_(std::move(r)),
36 t_(dayCounter.yearFraction(modelReferenceDate, referenceDate)), model_(std::move(model)) {
38 }
39
41 return Date::maxDate();
42 }
43
45 r_ = r;
47 }
48
50 return model_->discountBond(t_, T+t_, r_);
51 }
52}
1-D array used in linear algebra.
Definition: array.hpp:52
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
static Date maxDate()
latest allowed date
Definition: date.cpp:771
day counter class
Definition: daycounter.hpp:44
const ext::shared_ptr< AffineModel > model_
DiscountFactor discountImpl(Time) const override
discount factor calculation
Date maxDate() const override
the latest date for which the curve can return values
FdmAffineModelTermStructure(Array r, const Calendar &cal, const DayCounter &dayCounter, const Date &referenceDate, const Date &modelReferenceDate, ext::shared_ptr< AffineModel > model)
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Interest-rate term structure.
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
Real DiscountFactor
discount factor between dates
Definition: types.hpp:66
Definition: any.hpp:35
STL namespace.