QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
hazardratestructure.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Jose Aparicio
5 Copyright (C) 2008 Chris Kenyon
6 Copyright (C) 2008 Roland Lichters
7 Copyright (C) 2008 StatPro Italia srl
8 Copyright (C) 2009 Ferdinando Ametrano
9
10 This file is part of QuantLib, a free-software/open-source library
11 for financial quantitative analysts and developers - http://quantlib.org/
12
13 QuantLib is free software: you can redistribute it and/or modify it
14 under the terms of the QuantLib license. You should have received a
15 copy of the license along with this program; if not, please email
16 <quantlib-dev@lists.sf.net>. The license is also available online at
17 <http://quantlib.org/license.shtml>.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the license for more details.
22*/
23
24/*! \file hazardratestructure.hpp
25 \brief hazard-rate term structure
26*/
27
28#ifndef quantlib_hazard_rate_structure_hpp
29#define quantlib_hazard_rate_structure_hpp
30
32
33namespace QuantLib {
34
35 //! Hazard-rate term structure
36 /*! This abstract class acts as an adapter to
37 DefaultProbabilityTermStructure allowing the programmer to implement
38 only the <tt>hazardRateImpl(Time)</tt> method in derived classes.
39
40 Survival/default probabilities and default densities are calculated
41 from hazard rates.
42
43 Hazard rates are defined with annual frequency and continuous
44 compounding.
45
46 \ingroup defaultprobabilitytermstructures
47 */
49 public:
50 /*! \name Constructors
51 See the TermStructure documentation for issues regarding
52 constructors.
53 */
54 //@{
57 const std::vector<Handle<Quote> >& jumps = {},
58 const std::vector<Date>& jumpDates = {});
60 const Date& referenceDate,
61 const Calendar& cal = Calendar(),
63 const std::vector<Handle<Quote> >& jumps = {},
64 const std::vector<Date>& jumpDates = {});
67 const Calendar& cal,
69 const std::vector<Handle<Quote> >& jumps = {},
70 const std::vector<Date>& jumpDates = {});
71 //@}
72 protected:
73 /*! \name Calculations
74
75 This method must be implemented in derived classes to
76 perform the actual calculations. When it is called,
77 range check has already been performed; therefore, it
78 must assume that extrapolation is required.
79 */
80 //@{
81 //! hazard rate calculation
82 Real hazardRateImpl(Time) const override;
83 //@}
84
85 //! \name DefaultProbabilityTermStructure implementation
86 //@{
87 /*! survival probability calculation
88 implemented in terms of the hazard rate \f$ h(t) \f$ as
89 \f[
90 S(t) = \exp\left( - \int_0^t h(\tau) d\tau \right).
91 \f]
92
93 \warning This default implementation uses numerical integration,
94 which might be inefficient and inaccurate.
95 Derived classes should override it if a more efficient
96 implementation is available.
97 */
99 //! default density calculation
100 Real defaultDensityImpl(Time) const override;
101 //@}
102 };
103
104 // inline definitions
105
108 }
109
110}
111
112#endif
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Default probability term structure.
const std::vector< Date > & jumpDates() const
Shared handle to an observable.
Definition: handle.hpp:41
Hazard-rate term structure.
Real defaultDensityImpl(Time) const override
default density calculation
Real hazardRateImpl(Time) const override
hazard rate calculation
Probability survivalProbabilityImpl(Time) const override
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
virtual DayCounter dayCounter() const
the day counter used for date/time conversion
const DefaultType & t
default-probability term structure
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Probability
probability
Definition: types.hpp:82
Definition: any.hpp:35