QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
factorspreadedhazardratecurve.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Roland Lichters
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
24#ifndef quantlib_factor_spreaded_hazard_rate_curve_hpp
25#define quantlib_factor_spreaded_hazard_rate_curve_hpp
26
27#include <ql/quote.hpp>
28#include <ql/termstructures/credit/hazardratestructure.hpp>
29#include <utility>
30
31namespace QuantLib {
32
34
41 public:
43 Handle<Quote> spread);
45
46 DayCounter dayCounter() const override;
47 Calendar calendar() const override;
48 const Date& referenceDate() const override;
49 Date maxDate() const override;
50 Time maxTime() const override;
52 protected:
53 Real hazardRateImpl(Time t) const override;
54
55 private:
58 };
59
60
61 // inline definitions
62
65 : originalCurve_(std::move(h)), spread_(std::move(spread)) {
68 }
69
71 return originalCurve_->dayCounter();
72 }
73
75 return originalCurve_->calendar();
76 }
77
79 return originalCurve_->referenceDate();
80 }
81
83 return originalCurve_->maxDate();
84 }
85
87 return originalCurve_->maxTime();
88 }
89
91 return originalCurve_->hazardRate(t, true) * (1.0 + spread_->value());
92 }
93
94}
95
96#endif
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Default-probability structure with a multiplicative spread on hazard rates.
Calendar calendar() const override
the calendar used for reference and/or option date calculation
const Date & referenceDate() const override
the date at which discount = 1.0 and/or variance = 0.0
Real hazardRateImpl(Time t) const override
hazard rate calculation
DayCounter dayCounter() const override
the day counter used for date/time conversion
Date maxDate() const override
the latest date for which the curve can return values
FactorSpreadedHazardRateCurve(Handle< DefaultProbabilityTermStructure > originalCurve, Handle< Quote > spread)
Handle< DefaultProbabilityTermStructure > originalCurve_
Time maxTime() const override
the latest time for which the curve can return values
Shared handle to an observable.
Definition: handle.hpp:41
Hazard-rate term structure.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
STL namespace.