23#ifndef quantext_probability_traits_hpp
24#define quantext_probability_traits_hpp
26#include <ql/termstructures/bootstraphelper.hpp>
27#include <ql/termstructures/credit/interpolateddefaultdensitycurve.hpp>
28#include <ql/termstructures/credit/interpolatedhazardratecurve.hpp>
29#include <ql/termstructures/credit/interpolatedsurvivalprobabilitycurve.hpp>
42 template <
class Interpolator>
struct curve {
43 typedef QuantLib::InterpolatedSurvivalProbabilityCurve<Interpolator>
type;
47 typedef QuantLib::BootstrapHelper<QuantLib::DefaultProbabilityTermStructure>
helper;
50 static QuantLib::Date
initialDate(
const QuantLib::DefaultProbabilityTermStructure* c) {
return c->referenceDate(); }
53 static QuantLib::Real
initialValue(
const QuantLib::DefaultProbabilityTermStructure*) {
return 1.0; }
56 template <
class C>
static QuantLib::Real
guess(QuantLib::Size i,
const C* c,
bool validData, QuantLib::Size) {
67 Date d = c->dates()[i];
68 return c->survivalProbability(d,
true);
73 static QuantLib::Real
minValueAfter(QuantLib::Size i,
const C* c,
bool validData, QuantLib::Size) {
76 return c->data().back() / 2.0;
79 Time dt = c->times()[i] - c->times()[i - 1];
84 static QuantLib::Real
maxValueAfter(QuantLib::Size i,
const C* c,
bool validData, QuantLib::Size) {
86 return c->data()[i - 1];
90 static void updateGuess(std::vector<QuantLib::Real>& data, QuantLib::Probability p, QuantLib::Size i) {
const QuantLib::Real maxHazardRate
const QuantLib::Real avgHazardRate
QuantLib::InterpolatedSurvivalProbabilityCurve< Interpolator > type
Survival probability curve traits.
static QuantLib::Real initialValue(const QuantLib::DefaultProbabilityTermStructure *)
static void updateGuess(std::vector< QuantLib::Real > &data, QuantLib::Probability p, QuantLib::Size i)
QuantLib::BootstrapHelper< QuantLib::DefaultProbabilityTermStructure > helper
static QuantLib::Size maxIterations()
static QuantLib::Real minValueAfter(QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
static QuantLib::Real guess(QuantLib::Size i, const C *c, bool validData, QuantLib::Size)
static QuantLib::Date initialDate(const QuantLib::DefaultProbabilityTermStructure *c)
static QuantLib::Real maxValueAfter(QuantLib::Size i, const C *c, bool validData, QuantLib::Size)