QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
survivalprobabilitystructure.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Ferdinando Ametrano
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
20#include <ql/termstructures/credit/survivalprobabilitystructure.hpp>
21
22namespace QuantLib {
23
25 const DayCounter& dc,
26 const std::vector<Handle<Quote> >& jumps,
27 const std::vector<Date>& jumpDates)
28 : DefaultProbabilityTermStructure(dc, jumps, jumpDates) {}
29
31 const Date& refDate,
32 const Calendar& cal,
33 const DayCounter& dc,
34 const std::vector<Handle<Quote> >& jumps,
35 const std::vector<Date>& jumpDates)
36 : DefaultProbabilityTermStructure(refDate, cal, dc, jumps, jumpDates) {}
37
39 Natural settlDays,
40 const Calendar& cal,
41 const DayCounter& dc,
42 const std::vector<Handle<Quote> >& jumps,
43 const std::vector<Date>& jumpDates)
44 : DefaultProbabilityTermStructure(settlDays, cal, dc, jumps, jumpDates) {}
45
47 Time dt = 0.0001;
48 Time t1 = std::max(t-dt, 0.0);
49 Time t2 = t+dt;
50
53
54 return (p1-p2)/(t2-t1);
55 }
56
57}
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Default probability term structure.
virtual Probability survivalProbabilityImpl(Time) const =0
survival probability calculation
Shared handle to an observable.
Definition: handle.hpp:41
Real defaultDensityImpl(Time) const override
instantaneous default density at a given time
SurvivalProbabilityStructure(const DayCounter &dayCounter=DayCounter(), const std::vector< Handle< Quote > > &jumps={}, const std::vector< Date > &jumpDates={})
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